GTM & GA enhanced ecommerce transaction bug – Fixed!

The Challenge

A standard integration of Google Analytics Enhanced ecommerce was giving us a bug with basic ecommerce transactions. Even more annoying, it was behaving irrational as our tests were showing up correctly in Google Analytics but, only 50% of real orders showed were registered. Orders were simply missing instead of the more common bug of missing data per order.

According to Google’s documentation, the integration was correct including the GTM settings and the debug showed up the right Tags triggered at the right time etc.

It is worth mentioning that this was by far not the first enhanced ecommerce integration that we had had been involved with so we thought that we had the experience to implement it correctly.

The challenge we had faced was simply: How do we fix this GTM & GA enhanced ecommerce transaction bug?


The Approach

The approach was simple, we went through the code and in-depth browser testing with on debug tool after another. The debug journey took us on the following path:

  • We went through the source code in hope to find faults with the integration.
  • The GTM debug tool was used during the testing but it seemed to work correctly.
  • The Tag inspector discovered another fault which caused some issues with bounce rate but the fix did not affect the ecommerce tracking.
  • We then turned to the Google Analytics debugging tool for Chrome which turned out to be the best way to solve the issue.


The Solution to the

‘GTM & GA enhanced ecommerce transaction error’

The GA debug tool reveal that the GTM tag sometimes sent empty values to GA. This was probably due to a slow server or page load which caused the trigger to fire before the data was made available by the platform.  This turned out to be the main fault, but the implementation was still not wrong according to Google’s instructions. However, at closer look at the instructions, Google recommends that if transaction data is not available when the page loads it is better to use an event when the transaction data becomes available.

We decided to try an event-based trigger which we were able to ensure that it didn’t fire until the Google Analytics Enhanced Ecommerce transaction data was ready. This event had to be hard coded in to the ecommerce platform but luckily, we had a good developer to implement the idea. The fix solved the issue and it is now reporting transaction data correctly ever since.

This approach is likely to be more reliable than the original integration, so it will be interesting to see if the accuracy will become better than the standard 5-10% discrepancy rate with GA.



If you have any issues with your Google Analytics ecommerce integration or any other technical ecommerce setup, give Stefan a call on 074 9561 2012. We are keen to help you too.