Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GA4 purchase event firing twice: how to find and fix it

TRK-079High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A GA4 purchase event tells Google Analytics that an order was completed. It is normally sent from the thank-you (order confirmation) page. If that page loads a second time, the same code runs again and the same order is reported twice.

Common triggers are a page refresh, the back and forward buttons, a bookmarked thank-you URL, a link to the page in a confirmation email, and a tag that fires on both page load and a dataLayer event. GA4 can remove some duplicates when they share the same transaction_id, but you should not rely on that alone. It does not help when the ID is missing or changes on each load, and your ad platforms and other tools have no such protection.

How one order becomes two purchases
  1. Customer paysOrder is created once
  2. Thank-you page loadspurchase event sent
  3. Customer refreshesSame page runs the tag again
  4. Second purchase sentSame order counted again
  5. Reports inflatedRevenue and ROAS look too high

The first load is correct. Every later load of the same page repeats the event.

Why it costs you leads or sales

Duplicate purchases do not lose orders, they make your data wrong. Revenue, conversion rate and return on ad spend (ROAS) look better than they are. You may then raise budgets on campaigns that are not really paying back.

The damage spreads further if the purchase is also sent to Google Ads, Meta or other platforms. Their bidding systems learn from conversions. Inflated or repeated conversions teach them to chase the wrong audiences and make your cost per acquisition look lower than it is.

Reported vs real revenueExample numbers
Reported vs real revenue (example)Real revenue: 5,000 $; Revenue in GA4: 6,000 $02,3004,6005,0006,000Real revenueRevenue in GA4$

Example: 100 real orders of $50 each, where 20 customers refresh the thank-you page once. GA4 reports 120 purchases.

How to check if your site has it

Check for duplicate purchase events
  1. Place a test order

    Use your store's test mode or a low-value real order. Stop on the thank-you page.

  2. Open GA4 DebugView

    In GA4 go to Admin > DebugView. Use Tag Assistant or the GA debug extension so your session shows up. Look for the purchase event.

  3. Reload the thank-you page

    Press refresh, then go back and forward. Watch whether a second purchase appears with the same transaction_id.

  4. Check the network tab

    In browser developer tools, open Network and filter for collect. Count requests containing en=purchase for one visit.

  5. Look for repeated IDs in reports

    In GA4 Explore, build a free-form report with the dimension Transaction ID and the metric Event count, filtered to the purchase event. Any ID with a count above 1 is a duplicate.

How to fix it

There are two layers. First, always send a unique transaction_id that matches the order number. Second, stop the event from running again for an order that was already reported. The second layer also protects Google Ads, Meta and other tags.

Fire purchase once per orderjavascript
(function () {
  var orderId = '{{ORDER_ID}}'; // replace with your order number from the page
  var key = 'fg_purchase_sent_' + orderId;
  try {
    if (localStorage.getItem(key)) return; // already sent
    localStorage.setItem(key, '1');
  } catch (e) {}
  window.dataLayer = window.dataLayer || [];
  dataLayer.push({ ecommerce: null });
  dataLayer.push({
    event: 'purchase',
    ecommerce: {
      transaction_id: orderId,
      value: 59.90,
      currency: 'USD',
      items: [{ item_id: 'SKU123', item_name: 'Example product', price: 59.90, quantity: 1 }]
    }
  });
})();
Fix by platform
  1. Pass the order ID

    Make sure the dataLayer purchase push includes ecommerce.transaction_id. Create a Data Layer Variable for it.

  2. Add a once-only guard

    Create a Custom JavaScript variable that returns false if localStorage already holds the order ID, and otherwise stores it and returns true. Keep one purchase trigger only.

  3. Use it as a trigger condition

    On the trigger for your purchase tags, add the condition that this variable equals true. Apply it to GA4, Google Ads and any other purchase tag.

  4. Remove duplicate tags

    In the Tags list, search for any second GA4 purchase tag or a trigger that fires on both All Pages and the custom event.

How to confirm it's fixed

One order, one purchase

Before

  • Refresh sends another purchase
  • Same transaction_id appears more than once
  • Ad platforms record extra conversions

After

  • First load sends one purchase
  • Refresh and back button send nothing
  • Each transaction_id counted once
Confirmation checklist
  • A test order shows exactly one purchase in DebugView
  • Refreshing the thank-you page sends no second purchase
  • Opening the page from the confirmation email sends none
  • Back and forward navigation sends none
  • Google Ads and Meta conversions also show one hit per order
  • The Transaction ID report shows no count above 1 for new orders

How to prevent it happening again

Prevention
  • Keep one owner for purchase tracking: one plugin, one tag or one pixel
  • Re-test with a reload after theme, plugin or checkout changes
  • Review tag triggers in GTM before publishing a new container version
  • Run a monthly Transaction ID duplicates report in GA4
  • Compare GA4 orders with your store's order count

How FunnelGuard handles this

FunnelGuard detects this issue only partly. A robot visitor runs your checkout journey on a schedule and checks the tracking hits sent to GA4 and your ad platforms. It counts duplicate purchase hits per run, so if the purchase fires twice during a single pass through the journey, you get an alert with a screenshot and a likely cause.

Cover the gap by hand
  1. Test after every change

    After any tracking, theme or checkout update, place a test order and reload the thank-you page while DebugView is open.

  2. Schedule a monthly report

    Save a GA4 Explore report on Transaction ID and Event count for purchase, and check for counts above 1.

  3. Compare totals

    Match GA4 purchases against orders in your store for the same period. A gap above your normal difference suggests duplicates.

You can start on the Free plan (1 site, 2 journeys, daily checks, no card). Paid plans have a 3-day free trial.

Questions people ask

Why is my GA4 purchase event firing twice?

Usually the thank-you page ran its tracking code a second time, because of a refresh, the back button or a link from the confirmation email. It can also be two tags sending the same event, such as a GTM tag and a hardcoded gtag call. DebugView shows which case it is: a duplicate on the first load points to two tags.

Does GA4 remove duplicate purchases automatically?

GA4 can ignore repeated purchase events that carry the same transaction_id. It does not help if the ID is missing or changes each time. Ad platforms such as Google Ads and Meta need their own deduplication, so fix the cause on your site.

How do I stop the purchase event firing when the thank-you page is refreshed?

Send the order number as transaction_id and store a flag in localStorage or a cookie the first time the event fires. If the flag exists for that order, skip the event. Apply the same condition to every purchase tag, not just GA4.

How can I find duplicate transactions in GA4?

In Explore, create a free-form report with Transaction ID as a dimension and Event count as a metric, filtered to the purchase event. Any transaction ID with a count above 1 was reported more than once.

Why is my GA4 revenue higher than my store's revenue?

Duplicate purchase events are a common cause. Others include tax or shipping being included in the value, or test orders being counted. Compare GA4 order counts with store orders and check the Transaction ID report for repeats.

Can FunnelGuard detect a duplicate purchase after a page refresh?

Only partly. FunnelGuard counts duplicate purchase hits within each run of your checkout journey, but it does not reload the thank-you page. Test refreshes by hand after changes.

Does a duplicate purchase also affect Google Ads conversions?

It can, if the same trigger fires your Google Ads conversion tag. Duplicates inflate reported conversions and can mislead automated bidding. Use a once-only guard on every tag, and send a unique order ID with Google Ads conversions too.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: duplicates per run; reload not simulated.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.