Enhanced Ecommerce is one of the most powerful and flexible features of Google Analytics. Its flexibility, though, leaves a lot of room for errors in the setup.
In this article, we are covering everything you need to know about the problem of duplicate transactions, a root cause of skewed data in many Google Analytics instances.
Detecting Duplicate Transactions
Duplicate transactions in Google Analytics means simply that a single transaction was counted more than once. This can dramatically skew your data because along with the transaction count, this also inflates the revenue, quantity and other metrics directly related to transactions.
To check if your Google Analytics E-commerce setup is affected by duplicate transactions, let’s start by creating a custom report (Customisation –> Custom Reports –> New Custom Report) with the following settings.
Dimensions: Transaction ID
Hit “Save” and you should see your Duplicate Transactions custom report right away.
Firstly, choose a time frame. I’d recommend starting with 30, 60 or 90 days depending on how many transactions your site generates and how often your analytics setup changes.
Secondly, sort your table by most Transactions first.
If every transaction ID shows only one transaction then congratulations, in the selected time frame there were no duplicate transactions.
Every number greater than one is a sign of duplicate transaction. Now, to get an overview of the magnitude of the problem, compare the number of transactions against the number of rows in the table. The latter is the actual count of unique transactions.
In the above screenshot, there are some duplicate transactions but considering the total amount of transactions, the problem is minor.
If your duplicate transaction ratio is >10% you have a serious problem with your e-commerce numbers and before fixing it, you should take your numbers with a grain of salt.
PS! We should be thankful that Google has kept Transaction ID available as a dimension in almost all reports instead of hiding them as they do with the Client ID, User ID, Session ID and other really useful dimensions (that you should track using custom dimensions).
Fixing Duplicate Transactions
By far the most common reason duplicate transactions are happening is that a transaction hit is sent to Google Analytics every time the “thank you” page is loaded. There are people who bookmark this page and go back to check the order id for tracking or whatnot. Also, some companies send the “thank-you” URL in the order confirmation email.
To fix this, there are two possible solutions.
Make the event trigger based on something coming from the back end, something that only triggers when the actual transaction is happening. For example, after the user has entered their credit card information and pressed “Complete payment” and your system has validated the transaction. I.e. just before redirecting the user onto the “thank you” page.
Make your “thank you” pages to load only once. If you keep your transaction hits on the “thank you” page, make sure a user can see and visit the page only once. Every subsequent attempt to access this page should redirect them to some other page. This could be an order overview page or something similar (should still be order-related and contain order details).
Now, to take it one step further, you can make your e-commerce tracking even more reliable by sending transaction hits straight from the back end using Measurement Protocol. This way you can make sure that no transaction goes untracked or that someone is sending fake transactions towards your Google Analytics instance.
Another option is to use
localStorage to keep track of transaction IDs that have already been sent to Google Analytics. This method is described in detail by Simo Ahava in this blog post.
Google Analytics is an excellent tool for keeping track of your e-commerce business. What you need to keep in mind, though, is that skewed numbers can do more harm than having no numbers at all.
This is why you should audit (or have someone else do it for you) your Google Analytics and Enhanced Ecommerce setups regularly and compare the numbers in GA against the numbers in your back end and accounting.
If you see that the numbers don’t add up, see if you have any duplicate transactions by creating a simple custom report seen in the beginning of this blog post.
Have any questions or thoughts about detecting and fixing duplicate transactions in Google Analytics? Post them in the comments below.