Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello.
We are running GA4 measurements with GTM embedded in our Shopify store.
It is generally working fine, but the purchase event is occasionally firing in duplicate.
I checked the search report and found several pages with 2 purchase events and 1 display count. (Not all, but only some of them.)
We created a test environment and ran the operation several times, but the same phenomenon did not occur.
I think that GTM is probably sending the purchase event twice, but I have no idea why this is happening.
I have written the js to send the event as window.dataLayer.push and send it only once on the page.
I would appreciate any information you can give me if you are having similar problems or if you have solved the problem.
Thank you in advance.
Hello! We see the same in our store! We've checked this other topic but don't have duplicate transactions for every transaction. Just some random duplicate transactions. We couldn't reproduce this in our test environment.
I fear this could be an error with first_time_accessed function or some Shopify error there.
Another theory I have is when users select PayPal as payment provider. Can you check this
@nni in your store? I also saw a duplicate order that paid with Shop Pay...
This is the relation between date and transactions. The strange thing is that this occurs almost every 2-3 days.
EDIT:
I've found this on a WooCommerce GitHub discussion:
"The issue seems to be that in certain scenarios some devices/browsers will reload a page locally (and re-run scripts) without a server request. For example, when a customer completes an order on their phone, then leaves the browser with the page still open. When they return to it several hours or days later the page gets reloaded without a full refresh.
The suggested fix is quite simple. In addition to the server side protection, we add a localStorage item with the order number and check against that before firing a second time."
I'm gonna try that suggestion and let you know if it works
Did this work?
Hello! We observing the similar issue that 2 purchase events were captured by GA4 measurements via GTM tag for the same Transaction ID. Anyone solved this double purchase event counting problem?
Have tried add the conditional if tag on first_time_accessed variable, but is not working. Also tried to combine first_time_accessed variable with post_purchase_page_accessed variable as suggested in this link, refer: https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/pixel-tracking-post-purchas... . But still have double event counted issue intermittently.
Hope someone can shed some lights. Thanks in advance.
I wonder if this has to do with Google Channel App now sending its own data layer causing duplication?
I got eh same problem - some purchase events in GA4 are counted twice. Is there any fix to that yet?
Thanks
Hi, pls do check whether both GA and GTM are firing purchase event. Probably try disable the GTM purchase event to see whether it helps.
If you have the Google app installed on your Shopify instance this is already sending the purchase data to GA4 ---make sure you don't have the GA4 tag active in GTM this might be causing the duplicates.
Next make sure you have the GTM tag properly installed in your Shopify theme's header and body per the instructions. If you're looking to track specific events for example you're using Google Ads, add those particular events you want to track in GTM and confirm the conversion IDs all match
Hope that helps
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025