Articles

How to Handle Repeat Transactions in Google Analytics?

Used tools

In this article, we take a closer look at the causes of repeat transactions when using Enhanced Ecommerce in Google Analytics, and provide a solution to this issue. We also share the Google Tag Manager setup procedure that helps you prevent duplication in the majority of cases. If you are:

using Google Tag Manager or looking for more GTM advantages to use in future

— this article is for you.
The most common problem occurs when, repeat transactions inflate the number of the sold goods and the revenue metrics. This results in the overstatement of all indicators related to the revenue: the average check, ROAS, ROI etc. Thus, you may overestimate some of the sales channels and make wrong decisions based on inaccurate data.

Understanding the root causes

In most Ecommerce projects, the data on the transactions is sent to Google Analytics when a user is redirected to the «Thank You» page. However, there may be situations when users access the page more than once (e.g. refresh the page), without redirect. This leads to the common problem of repeat transactions. To see if such a problem exists in your project, you can create a custom report. To do this, open the «Customization» tab in Google Analytics and press «+New Custom Report».

In the report, select «Transactions» as the metric and «Transaction ID» as the dimension:

In the Custom Report in Google Analytics, the problem looks approximately as follows:

It would make sense, of course, to solve the problem by implementing a mechanism that would redirect a user when attempting to reload the page. It’s not always possible to promptly change the global logic of the website. Moreover, such changes may not meet the goals of your company. In this case, using Google Tag Manager on a project provides a significant advantage, especially if you are a marketing specialist or an analyst and do not have access to the code of the website. Google Tag Manager allows you to implement a mechanism to write all the IDs of the customer’s transactions to the cookie and to avoid repeat transactions by setting a few variables, one trigger and one tag. This method does not allow for avoiding duplication in 100% of cases, as there are users who periodically erase cookies, or simply don’t allow recording them, but in 95% of cases you will get reliable data on the transactions.

Setup procedure in Google Tag Manager

In short, the mechanism is as follows:

When the «Thank you» page loads, the transaction ID is written to the GTM variable.

The value of the variable is compared with the value in the user’s cookie:

If the cookie contains the ID under check, the tag with the transaction is not fired due to the auxiliary variables, and the transaction is not sent to Google Analytics;

If the cookie does not contain the ID under check, then the tag with the transaction is triggered and the data is sent to Google Analytics;

If the tag with the data on the transaction is triggered, the value of the current transaction ID is added to the cookie.

When attempting to resend the transaction with the same ID, the algorithm is repeated and it prevents resending the data to Google Analytics.

The Result

As a result, you get the solution to the problem of repeat transactions in Google Analytics. For this, you won’t need to turn to your developers team, distracting them from other important tasks. In our experience, this setup will only take about 30 minutes of your time. After implementing this algorithm, you will get reliable data on the revenue and the number of orders in Google Analytics.