How to Handle Duplicate Transactions in Google Analytics 4?

GA4
Demo

In this article, we take a closer look at the causes of repeat transactions when using E-commerce Tracking in Google Analytics 4 (previously known as Enhanced E-commerce) and provide a solution to this issue. 

We also share the Google Tag Manager setup procedure that helps you prevent duplication in most cases. If you are:

  1. Tracking orders on your website with Google Analytics 4 or plan to start tracking them;
  2. In need of accurate data on the orders instead of duplicate transaction values;
  3. Using Google Tag Manager or looking for more GTM advantages to use in the future

— this article is for you.The most common problem occurs when repeat transactions inflate the number of transactions, goods sold, and 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.

Note: This post was originally published in September 2016 and was completely updated in January 2024 for accuracy and comprehensiveness on marketing analytics.

Understanding the root causes

In most Ecommerce projects, the data on the transactions is sent to Google Analytics 4 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 redirecting. This leads to the common problem of repeat transactions.

Common scenarios include:

  • Returning to the confirmation page via an emailed link or bookmark.
  • Refreshing the confirmation page.
  • Navigate away and return using the back button.
  • Restoring a closed browser session.

To see if such a problem exists in your project, you can create a custom report.

How to Identify Duplicate Transactions in Google Analytics 4

To check for repeat transactions in Google Analytics 4, you can follow these steps:

1. Navigate to 'Explore' in Google Analytics 4: Access your Google Analytics 4 dashboard and go to the 'Explore' section.


2. Create a New Exploration: Start a new Blank exploration. This will allow you to customize the data you want to analyze.


3. Set Up Dimensions and Metrics: Name it and Choose 'Transaction ID' as your dimension and 'Purchases' as the metric. This setup will enable you to track individual transactions.


4. Analyze the Data: In the exploration, look at the 'Purchases' row. You need to identify if there is more than one transaction against 'Transaction IDs.' If a single Transaction ID is associated with multiple transactions, it indicates ga4 duplicate transactions or repeat transactions.


5. Further Analysis: Depending on your findings, you should investigate why these duplicates are occurring. This could be due to issues in the tracking setup or the way transactions are processed on your website.


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 change the global logic of the website promptly. Moreover, such changes may not meet your company's goals.

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 website code.

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 in Google Analytics 4.

Uncover in-depth insights

How to Set up [GA4] to BigQuery Export

Download now

Bonus for readers

How to Set up [GA4] to BigQuery Export

Setup procedure in Google Tag Manager

In short, the mechanism is as follows:

  1. When the Thank you or Confirmation page loads, the transaction ID is written to the GTM variable.
  2. 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 4;
    • 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 4;
    1. If the tag with the data on the transaction is triggered, the value of the current transaction ID is added to the cookie.
    2. When attempting to resend the transaction with the same ID, the algorithm is repeated, and it prevents resending the data to Google Analytics 4.

    Download the detailed GTM setup guide on how to prevent repeat transactions in Google Analytics 4.

    Additional Measures to Eliminate Duplicate Transactions in Google Analytics 4 (GA4)

    The following are additional measures to streamline the accuracy of transaction records in Google Analytics 4. Developers can implement the following steps -

    1. Restricting Multiple Confirmations: It's crucial to configure the system to prevent users from revisiting the order confirmation page after the initial view unless they initiate a new purchase. This precaution helps in avoiding the recording of duplicate transactions.
    2. Page Refresh Handling: Developers should either disable the ability to refresh the order confirmation page or, if that's not feasible, ensure that the e-commerce tracking script does not trigger again with each refresh. This step is necessary to prevent the duplication of order data.
    3. Staging Environment Checks: For those who employ identical coding on both staging and production environments, it's important to direct e-commerce data from the staging site exclusively to the GA4 test property. This action prevents test data from contaminating the live transaction data.
    4. Transaction ID Creation Protocols: Adhering to established best practices for generating unique transaction IDs is pivotal. By ensuring that each transaction ID is distinct, one can maintain the integrity of the order data within GA4.

    By following these outlined practices, developers can help maintain clean and accurate transaction data within GA4, thereby enhancing the reliability of data analysis.

    Key Takeaways

    As a result, you get the solution to the problem of repeat transactions in Google Analytics 4. For this, you won’t need to turn to your developer's 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 4.

    Automate your digital marketing reporting

    Manage and analyze all your data in one place! Access fresh & reliable data with OWOX BI — an all-in-one reporting and analytics tool

    Start Free Trial
    Measure CPO and ROAS in GA4

    FAQ

    Expand all Close all
    • What do duplicate transactions mean?

      A duplicate transaction in the context of web analytics refers to a scenario where a single transaction, such as a purchase on a website, is recorded more than once in the analytics data. This redundancy can lead to inaccuracies in data reporting and analysis, overstating sales figures and impacting the reliability of the data
    • What causes duplicate transactions in Google Analytics?

      Duplicate transactions in Google Analytics can occur due to various reasons, such as multiple clicks on the purchase button by the user, page refresh, or technical errors.
    • How can I identify duplicate transactions in Google Analytics?

      You can identify duplicate transactions in Google Analytics by checking for identical transaction IDs, the same products and prices, and the time of purchase.
    • How can I remove duplicate transactions from Google Analytics?

      To remove duplicate transactions from Google Analytics, you can apply filters to exclude duplicate transactions, delete the transaction IDs manually, or use a third-party tool.