Although Google Analytics is an amazing service that helps in tracking e-commerce, many times it counts a transaction more than once. These duplicate transactions are caused because there is the possibility of logging the same transaction more than once. Such issues are to be addressed manually because Google Analytics doesn’t try to fix this error but considers that transaction more than once. This error could lead to many problems such as seeing excessive number of transactions. It can also have an impact on e-commerce conversion rate, sales quantity, and revenue totals. In addition, it will show a higher average order value than it is in reality. All the issues will then lead to questioning the credibility of data, and with incorrect data, the probability of making bad decisions increases massively.

How to Prevent Duplicate Transaction?

Duplicate transactions can be prevented by one of the following methods:

A. Using Google Tag Manager (GTM)

As of now, Google Analytics doesn’t have a solution for differentiating repeat transactions, but the issue of duplicate transactions can be resolved by using appropriate codes.

One of the simplest ways is to set up a tag so that every time a user visits a confirmation page or thank-you page, a cookie is written out. Although it isn’t a bad approach, it wouldn’t provide a surety of whether the transaction was tracked by Google Analytics or not. Therefore, we would suggest deploying the “hitCallback” feature of Google’s Universal Analytics. This feature sets the cookies after Google Analytics successfully receives the data. To utilize this feature, in Google Tag Manager, set the value of hitCallback to “Tag to a Custom JavaScript Variable.” Now that JavaScript should return a function that does the following:

Use only one cookie for all transactions that are joined using a pipe ( “|” ) symbol in order to avoid assigning a cookie to each transaction. Now, the ongoing transaction ID will be added to this newly created transaction cookie every time a transaction is sent to Google Analytics.

A first-party variable will also be required to grab this newly created transaction cookie in the following way:

This tracking flow will now do the following :

B. Using Server Side

Although GTM is an efficient way to handle such issues, if one has the time and energy to handle it, server side will reap better results. Some sort of server-side logic can be invoked to ensure that the e-commerce analytics code is sent only once to a particular page. One of the ways would be to use a database record to verify if e-commerce info has been sent. Another way could be deploying a server-side variable that could be checked in a similar fashion. Then there is the option where a user is redirected to a different page after the e-commerce information has been sent to Google Analytics and then not allowing the user to return to that page.

When Do Duplicate Transactions Occur?

Duplicate transactions can occur because of a myriad of reasons. The following are the most commons causes for a duplicate transaction:

Thus, using these methods, you can successfully de-duplicate identical transactions. And by fixing duplicate e-commerce transactions, which is the most common issue with e-commerce sites, you can prevent revenue from inflating and your attribution reports from being altered, thus protecting data integrity.

Did you have duplicate transactions on your site? Want to know more about anomaly detection in google analytics for your website’s ecommerce transactions? There is a great deal of insight in your data and our e-commerce web analytics experts will dig out and fix any issues related to transaction in web analytics. Request for a free web analytics audit today.

About author

Saurabh Kumar

A marketing enthusiast with a fascination for technology, an interest in tinkering with data and systems, and 4+ years of experience at ebookers, Saurabh Kumar Founder Envigo, a digital marketing agency, in the year 2007. His passion for Digital Marketing led him to launch a data-driven digital marketing solutions agency.

View posts by Saurabh Kumar

Would you like to work with us?

Get in touch.

You might also like