简体   繁体   中英

eCommerce Tracking With Tag Manager Showing in dataLayer but no in Analytics

I have setup a test page here http://thiswebguy.com/wrdtest/transaction-thanks.html which uses the example code found on the GTM help section.

I have checked the console and the product data is in the dataLayer, I have also used GADebugger and it says that the product has been sent to Analytics 'Tacking Beacon Sent' (it also lists the products and transaction info).

So I would assume that it would work and begin to show in Analytics.... But it's not!

I have added the event trackTransaction to the beginning:

'event': 'trackTransaction',

This isn't in the Google docs but it didn't work without it, and although it still doesn't now all the data is still showing in the dataLayer and GA Debugger.

I have two rules which fires when the event 'trackTransaction' is triggered; and to only fire once the dom is loaded.

In my previous setup I had two tags also one was the 'only fire when dom is loaded' tag and the other was fire only on the thank you page - but it gave me the same results as using the event.

I've waited two days for the data to show by the way.

Any help would be appreciated!

You're placing the dataLayer object in the <body> . Try moving it to the <head> and removing your 'event':'trackTransaction' , and just have set your rule to fire on the {{url}} equals /thank-you-page.

<html>
<head>
<script>
dataLayer = [{
    'transactionId': '1234',
    'transactionAffiliation': 'Acme Clothing',
    'transactionTotal': '11.99',
    'transactionTax': '1.29',
    'transactionShipping': '5',
    'transactionProducts': [{
        'sku': 'DD44',
        'name': 'Test Prod',
        'category': 'Apparel',
        'price': '11.99',
        'quantity': '1'
    },{
        'sku': 'AA1243544',
        'name': 'Test Prod Again',
        'category': 'Apparel',
        'price': '9.99',
        'quantity': '2'
    }]
}];
</script>
</head>
<body>
<!-- GTM Container Code -->
</body>
</html>

Ok I found out why, you actually need to type: dataLayer into the console.

Thanks for the help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM