How To Find Duplicate Transactions And Fix Them In GA4 | 2023
For an e-commerce website, transactions are one of the most important events as they are directly related to the revenue generated and the overall functioning of the business. Google Analytics 4 has a dedicated metric called ‘Transactions’ that helps web store owners measure sales-related activities like purchases and returns happening on their websites.
Apart from revenue, measuring transactions also helps online business owners analyze the effectiveness of their marketing activities, website UI, and customer behavior. Naturally, it is a top priority for analytics professionals at e-commerce companies to measure transactions correctly.
However, a significant number of countries are introducing user privacy-focused legislations and browsers like Brave are proactively blocking trackers by default. This is significantly affecting the ability of analytics solutions like Google Analytics to track data.
In fact, Google had to introduce GA4 because Universal Analytics didn’t conform to these regulations and it needed to do away with the third-party cookies, making server-side tracking the only viable option for analytics.
If you are a website owner who migrated or wants to migrate from UA to GA4, you will notice that Google Analytics 4 is quite problematic when it comes to measuring transactions. You will often find that it misses transactions or shows duplicate transactions which is a big problem for all e-commerce stores.
Thus, I decided to write a quick and simple guide on how to find duplicate transactions in GA4 and fix them. Towards the end, I will also throw some light on why you must not expect 100% accurate insights from GA4 (and its not Google’s fault!) to help you make better business decisions.
Let’s get started:
How To See Purchases By Transaction Id
Before we start finding ‘duplicate transactions’, we must first know where to find the list of transactions in Google Analytics 4.
In Universal Analytics, you just need to navigate to ‘Conversions’ and click on ‘E-Commerce’ to locate ‘Transactions’ to get a transaction-id wise list of all transactions.
Here’s the process to view purchases by Transaction Id in GA4:
- To see purchases by Transaction Id in Google Analytics 4, you need to navigate to ‘Explore’ and choose a blank template i.e. create a new exploration.
- Next, set ‘Transaction IDs’ as rows and ‘Date’ as columns. Add ‘Purchase revenue’ as values.
How To Find Duplicate Transactions In Google Analytics 4 (GA4)?
In this section, we will go through the quick and simple process to find duplicate transactions in GA4.
Navigate to ‘Explore’ on your Google Analytics 4 dashboard.
Create a new free form exploration with Transaction ID as your dimension and Transactions as the metric.
You will be able to see something like this after following the steps mentioned above:
To find duplicate transactions, just view the ‘Transactions’ row and look for more than one transaction against ‘Transaction Ids.’
In the above image, you will be able to find two transactions for multiple Transaction Ids in the rows 5, 6, 8, and 13.
This is caused because the transactions were fired twice. If they had been fired multiple times e.g. seven, the value would have been seven and GA4 would have shown 7x the real revenue for that particular transaction.
There’s an alternate method to view duplicate transactions:
Go to GA4 DebugView and if you find the same event more than once, you are likely to face issues with transaction duplication:
That’s a huge problem, isn’t it?
What Causes Duplicate Transactions In Google Analytics 4 (GA4)?
In order to fix the issue of duplicate transactions in GA4, we first need to understand why they occur in the first place.
In this section, we will quickly go through X reasons why duplicate transactions occur in GA4:
1. User Activity Related Issues
You might be seeing duplicate transactions due to returning traffic i.e. a
- The user visits your e-commerce website’s product page multiple times.
- Refreshing the (product) page before it fully loads.
- The user restarts/restores after a closed browser session.
- Repeatedly hitting forward and backward buttons.
- The user navigates to a new page and returns to using the back button
Generally, these issues can be solved by streamlining GTM (Google Tag Manager) which we will discuss later in this article.
2. dataLayer Event Duplication
Bugs can cause the dataLayer.push to be activated multiple times in the GA4 Debug View after a visitor clicks the “Add To Cart” button.
3. (Mis)use of Google Analytics 4’s ‘Create event’ feature
Many users find the ‘Create event’ feature under the Events tab in the Admin dashboard and instinctively create purchase events in the GA4 interface.
However, most users would have already created the same event in Google Tag Manager and it ultimately leads to duplicate transactions since both GA4 and GTM send the same event.
4. You Have Configured The Same Event In GTM and GA4
It is observed that many e-commerce website owners end up adding GA4 tracking codes on the website’s source code and configure the same tracking code using Google Tag Manager. This creates a similar problem as discussed in the above point since both approaches (Hardcoded website tracking and GA4 + GTM) send the same data to Google Analytics 4.
5. Problematic Trigger Configuration
There are good chances of ‘trigger misconfiguration’ due to your developer’s mistakes (or even bugs) and it isn’t easy to detect one.
But we will discuss how you can work your way around it in the next section.
6. The Thank You Page Is Loaded Multiple Times
In case your e-commerce website allows the user to load the ‘Thank You’ page multiple times, it may result in transaction duplication since most developers configure the loading of the Thank You page as the trigger for measuring a transaction.
7. GTM Containers Are Repeated On The Website
Lastly, there is a chance that your developer might have added the same Google Tag Manager container on the website ultimately leading to transactions getting duplicated.
How To Fix The Duplicate Transaction Problem In Google Analytics 4 (GA4)?
In this section, we will go through the solutions for fixing duplicate transactions that occur due to the above mentioned reasons:
1. How To Solve User Activity Caused Transaction Duplication
To fix the transaction duplication caused by user activities mentioned in the above section, you may follow the below steps using Google Tag Manager:
- Use a Custom JS variable to verify that the transaction id about to be fired corresponds to the one currently saved in a cookie/in local storage.
- You must trigger the buy tag based on the value returned by the preceding variable.
- Fire a tag immediately after the buy tag to fetch the Transaction ID and save it to a cookie/local storage.
2. How To Solve dataLayer Event Duplication
To fix duplicate dataLayer events, you need to take help from your developer to ensure that the event is fired only one time for every interaction by correcting the code.
3. How To Fix Duplicate Transactions Issue Caused By Firing The Same Event Through GTM And GA4’s ‘Create event’ feature
Do not use the ‘Create Events’ feature for creating the events that you have already created in the Google Tag Manager. In case you have created it using both, delete the one in Google Analytics 4.
4. How To Solve Transaction Duplication Caused By Configuring The Same Event In GTM and GA4
Firstly, you must check your e-commerce website’s source code to see if you have actually hard coded the same tracking code on your website as in Google Tag Manager, you might need the help of a developer.
Also, you can use Chrome’s developer tools and go to Sources. Next, hit + SHIFT +F (Mac) or CTRL + SHIFT + F (Windows) and type the name of the event (for example, add_to_cart).
If any of the codes in the results contain ‘gtag’, it is an indication that the corresponding event is being duplicated. Once detected, you must make appropriate changes to your online store’s website to resolve the issue.
Alternatively, you may remove the GTM container from your e-commerce site and see if GA4 still receives event data. Hence, the solution in this case is inline with the above case (point 3) i.e. to use only Google Tag Manager to track conversions.
5. How To Fix Duplicate Transaction Issue Caused Due To Trigger Misconfiguration
While there are a lot of ways to mess up trigger configuration, you can use the below process to see where things went wrong in your case:
- Start the Preview and Debug mode and perform the action that you suspect of creating duplicate transactions once you clear the stream.
- Now, navigate to the Summary and check whether the concerned tag is fired multiple times.
- In case it is fired at least two or more times, open the message and locate the triggering conditions that led to firing of the tag.
- From here, all you need to do is make these conditions more accurate and precise so that the concerned tag isn’t fired unless you wish so.
6. How To Solve Transaction Duplication Due Thank You Page Being Loaded Multiple Times
Basically, there are two ways to solve the problem of duplicate events caused by the user loading the Thank You page more than once:
Link the event to the backend so that it only triggers when a real transaction is made. For instance, the trigger should be fired only after your backend verifies the receipt of payment instead of triggering it after the user enters credit card details and clicks the "Complete payment" button. All of these activities must be completed before the user is redirected to the ‘Thank You’ page.
Now, you can also configure your ‘Thank You’ page to load only once the transaction is completed. If the user tries to reload the ‘Thank You’ page, the website must redirect them to another page like an order summary page.
On top of that, you may also use Measurement Protocol to send transaction hits from the backend. You may also try using localStorage to keep records of the transaction IDs sent to Google Analytics 4.
7. How To Solve Transaction Duplication Due Repeated GTM Containers On The Website
To check if you are facing this issue, disable the preview mode and open Chrome and follow the steps mentioned below:
- Go to Developer Tools and click on the Network tab.
- Now type ‘gtm.js’ in the search field and see if you get more than one result, verify if it was intended to have multiple GTM containers
- If not, contact your developer to get it fixed and you are all set to go!
Zander Aycock suggested another tip which can help you with the issue:
Data Streams > Choose your data stream > Configure tag settings > Click on Your Google Tag > "Ignore duplicate instances of on-page configuration (recommended)".
Ultimately, we recommend ecommerce stores to set up server side tagging to improve the overall accuracy of analytics.
I hope that you will be able to identify the reason for duplicate transactions on your GA4 with the help of this quick guide. If you have any questions/suggestions, feel free to write to us at firstname.lastname@example.org for getting the solution.