We recently implemented an awesome fix for Duplicate Transactions in Google Analytics Enhanced Ecommerce and wanted to pass on details about how it works.
If you have GA Enhanced Ecommerce installed on your site – you will surely have come across this problem. DUPLICATE TRANSACTIONS. The same supposedly unique transaction id repeated multiple times, over multiple days. See below for an example of what I mean:
Well read articles such as Jon Meck’s (LunaMetrics) post detail some of the reasons and scenarios of why this occurs. They include:
- Returning to the thankyou page via email link or bookmark
- Refreshing the thankyou page
- Hitting the back button from another page
- Page restoring after session has closed
The Solution We Use
We really love how simple and elegant this solution is. It basically revolves around the following steps:
- setting a 1st party cookie on user’s browsers when they have completed a transaction using GTM (very easy!). This cookie simply contains the transaction id itself, set by Enhanced Ecommerce.
- At the same time adjusting the purchase tag firing rule slightly – to check and see if this cookie exists already on someone’s browser. If it does… we block it from firing!
The credit for this fix goes to the original authors, so we leave it up them to outline the technical steps – for old-school GA Ecommerce see Simo Ahava’s solution here, or for Enhanced Ecommerce follow David Vallejo’s amendment to Simo’s solution here.
We have implemented the solution multiple times and can confirm that it works BEAUTIFULLY! It is also very straightforward to implement so long as you know your way around GTM.
If the above looks too complicated and you need help fixing your Enhanced Ecommerce duplicate issues drop us a line and we can implement the fix for you!