There is a store, a Data Layer is made on the page of a successful purchase, when the page is updated, it is no longer displayed (it is stored once per session). Duplicate orders began to appear in analytics, found this solution: https://www.thyngster.com/preventing-duplicate-transactions-in-universal-analytics-with-google-tag-manager/

Doubles do not matter, with what the reports have found that only on Android and iOS and not at all, only part of the orders. I think that the browser somehow caches the page with the data layer, and under some conditions it performs js again.

Has anyone come across this?

    3 answers 3

    If users have the opportunity to re-enter the page of a confirmed order from another device (for example, you send a link to such a page to mail) and on this page data on the transaction is recorded in the dataLayer, then you will receive duplicate transactions.

    It is better to solve problems of duplicate transactions not through cookies in the browser, but through setting up the backend logic - the transaction data should not be transmitted to the dataLayer whenever you reload the page of the confirmed order.

      I solved it like this.

      1. I saved the data in sessions and not in cookies. Since the accounts are synchronized, and the cookies are on the client side, and the cookies are deleted only after the page has been processed, it means that if a person logged in from the computer, and then from the mobile device, 2 datalayer will be sent.
      2. It is necessary to close access to the page of successful purchase from all fronts))) except 1, this is the basket, or the other part where the purchase ends.

        The problem turned out to be related to the Apache settings: the checkout success page was enabled for caching.