Enhanced E-commerce tracking not working for real purchases in Google Analytics

I’m having trouble with Enhanced E-commerce tracking. It works fine in Google Tag Assistant, but not for actual customer purchases. Here’s what I’ve done:

  1. Added this code to the thank-you page:
dataLayer.push({ ecommerce: null });
dataLayer.push({
  'event': 'purchase',
  'ecommerce': {
    'transaction': {
      'id': 'ORDER_ID',
      'revenue': 'TOTAL',
      'items': 'ITEM_COUNT'
    },
    'items': [
      {
        'name': 'PRODUCT_NAME',
        'id': 'PRODUCT_ID',
        'price': 'ITEM_PRICE',
        'quantity': 'ITEM_QUANTITY'
      }
    ]
  }
});
  1. Set up a tag in GTM for the purchase event
  2. Created a trigger for the transaction
  3. Added variables for order details

Everything looks good in Tag Assistant, but real orders don’t show up in Analytics. Any ideas what I’m missing?

I’ve encountered similar issues with Enhanced E-commerce tracking before. One often overlooked aspect is ensuring that the dataLayer variables are correctly populated with dynamic values from your server-side code. Check if your backend is properly passing the order details to the front-end. Another potential issue could be the timing of the dataLayer push. If it’s executed before the GTM container loads, the purchase event might not be captured. Consider using the ‘eventCallback’ function to ensure the push occurs at the right moment. Lastly, verify that your GTM container code is present and firing correctly on the thank-you page. Sometimes, redirects or page load issues can interfere with proper tracking. If all else fails, implementing server-side tracking might be a more reliable solution for capturing purchase data.

yo mike, i had the same issue. check ur server logs to see if the data is actually being sent. also, make sure ur not blocking any scripts with ad blockers or sumthin. sometimes that messes things up. oh and double check ur ga property settings, might be a filter blocking stuff. good luck man!

Hey there Mike_Energetic! :slightly_smiling_face:

Hmm, that’s a tricky one. Have you double-checked that the variables in your code are actually being populated with real data during live transactions? Sometimes what looks good in Tag Assistant doesn’t quite translate to the real world.

Also, I’m curious - are you seeing any errors in the browser console when actual purchases happen? That could give us a clue about what’s going wrong.

Oh, and one more thought - have you tried implementing a backup method, like the older ga(‘ecommerce:send’) tracking? It might help pinpoint if the issue is with Enhanced Ecommerce specifically or something else in your setup.

Keep us posted on what you find out! I’m really interested to see what solves this mystery. :man_detective: