0
votes

I'm (trying) to implement Enhanced Analytics on an aspx/mvc website.

First, I set up a UA Tag triggering off the custom event "checkout": Tag Type: Universal Analytics Track Type: Event Event Action: Checkout Enable Enhanced Ecommerce Features: true Use Data Layer: true

Then, I created a Custom HTML tag to push the checkout event to the Data Layer; firing off of Window Load of the checkout URL. the custom HTML is:

<script type='text/javascript'>
(function() {
    dataLayer.push({
        'event': 'checkout',
        'ecommerce': {
            'checkout': {
                'actionField': { 'step': '1' },
                'products': [{
                    'name': 'product1',
                    'id': '123456',
                    'price': '500',
                    'dimension2': 'Acccepted',
                    'dimension5': '12345'
                }]
            }
        }
    });
})
</script>

GTM preview shows the custom html tag firing but the associated UA Event tag does not fire.

Help?

1

1 Answers

1
votes

You have a small mistake in your JS. You forgot to call defined function (pay attention at () at the end):

(function() {
    dataLayer.push({
        'event': 'checkout',
        'ecommerce': {
            'checkout': {
                'actionField': { 'step': '1' },
                'products': [{
                    'name': 'product1',
                    'id': '123456',
                    'price': '500',
                    'dimension2': 'Acccepted',
                    'dimension5': '12345'
                }]
            }
        }
    });
}())