E-commerce Tracking Issues with Google Analytics

Our online store is having trouble with e-commerce tracking in Google Analytics. We've added the tracking code to our order confirmation page but it's not working as expected. Google support couldn't help so they sent us here.

Here's what we've got on our success page:

<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');

dataLayer.push({
  'transactionId': 'T12345',
  'transactionAffiliation': 'Online Store',
  'transactionTotal': 38.95,
  'transactionTax': 3.85,
  'transactionShipping': 5.34,
  'transactionProducts': [{
    'sku': 'DD44',
    'name': 'T-Shirt',
    'category': 'Apparel',
    'price': 11.99,
    'quantity': 1
  },{
    'sku': 'AA1243',
    'name': 'Socks',
    'category': 'Apparel',
    'price': 9.99,
    'quantity': 2
  }]
});
</script>

Is this set up correctly? We've also got the basic GA tracking code in our header. Any ideas why it's not tracking sales? Thanks for any help!

Your e-commerce tracking setup looks mostly correct, but there are a few potential issues to consider. First, ensure your GTM container ID (GTM-XXXX) is replaced with your actual ID. Also, the dataLayer push should ideally come before the GTM script to ensure all data is captured.

Another common problem is that the transaction data might not be dynamic. Make sure you’re populating the dataLayer with actual order details from your backend, not static values.

Have you checked if the GTM container is properly configured to send this data to Google Analytics? You’ll need to set up tags, triggers, and variables in GTM to translate this dataLayer information into GA e-commerce events.

Lastly, verify that you’re looking at the correct GA property and that there’s no sampling or filtering affecting your data. Sometimes, it takes 24-48 hours for data to fully process in GA. If none of these solve the issue, you might want to use the GA Debugger Chrome extension to see if hits are being sent correctly.

Hey there, fellow e-commerce enthusiast! :wave:

I’ve been tinkering with GA tracking for a while now, and your setup got me thinking. Have you considered using Google Tag Assistant to debug this? It’s like a secret weapon for spotting those sneaky tracking issues!

Also, I’m curious - are you using Universal Analytics or GA4? The setup can be quite different between the two. If you’ve recently switched, that might explain some hiccups.

Oh, and here’s a wild thought - could your ad blocker be messing with the tracking? I once spent days pulling my hair out only to realize my trusty ad blocker was the culprit! :sweat_smile:

What kind of platform is your store running on? Some e-commerce platforms have quirks with GA integration. Shopify, for instance, can be a bit finicky sometimes.

Keep us posted on what you find out! This stuff can be tricky, but it’s so satisfying when you finally crack it. Good luck!

hey there! have you checked if your ecommerce settings are enabled in GA? sometimes ppl forget that step. also, make sure ur using the right property ID. I’ve seen folks accidentally use the wrong one before. oh, and double-check that ur not blocking the GA script with any browser extensions. those can be sneaky troublemakers!