Fixing Ghost Transactions and Duplicate Purchases in GA4
Fixing Ghost Transactions in GA4

๐Introduction
An ecommerce site noticed GA4 was reporting transactions with $0 revenue value and multiple duplicate purchase events for single orders โ corrupting their revenue data and making accurate financial reporting impossible.
โThe Problem
GA4 showed 340 purchase events in a month where Shopify recorded 189 orders. Revenue in GA4 was $127K while actual revenue was $94K. Ghost transactions ($0 value) and true duplicates were inflating both transaction count and revenue figures significantly.
๐Identifying the Causes
Two separate issues were found: (1) The purchase event was configured to fire on the order confirmation page URL without a deduplication check โ browser back-button presses and page refreshes re-fired the event. (2) A Shopify app had a GA4 integration that fired a second purchase event using a different data format, creating duplicate hits with inconsistent revenue values (sometimes $0).
โ ๏ธConsequences for the Business
GA4 revenue data was unreliable for financial reporting. The finance team had stopped trusting analytics and was reconciling manually against Shopify. Google Ads was optimizing against inflated conversion values, causing smart bidding to over-bid on campaigns.
โ Solution
Implemented transaction ID deduplication: stored the transaction ID in sessionStorage immediately after the first purchase event fired, and added a GTM condition to prevent the tag from firing if the ID already existed in storage. Identified and removed the conflicting Shopify app's GA4 integration. Added the transaction_id parameter to GA4's deduplication configuration in the Admin settings.
๐Results
Purchase events aligned to within 2% of Shopify order count (the gap explained by legitimate order cancellations). Revenue reporting became accurate. Google Ads smart bidding was reset and re-trained on clean data, resulting in 24% ROAS improvement over 8 weeks.
๐Conclusion
Ghost and duplicate transactions are among the most damaging data quality issues in ecommerce analytics. sessionStorage-based deduplication combined with GA4's built-in transaction ID deduplication provides robust protection.
๐กKey Takeaways
Always use sessionStorage to prevent duplicate fires on page refresh. Configure transaction_id as a deduplication key in GA4 Admin. Audit all third-party apps for hidden GA4 integrations โ Shopify apps frequently add tracking without disclosure.