How to Connect Shopify to GA4 (and Track Every Purchase Correctly)
8 min read · AstraLoop Studio
Almost every Shopify store has GA4 "connected." Very few have connected it well. And the difference isn't cosmetic: if GA4 counts the same order twice or loses half of them, every decision you make on top of those numbers (how much to spend on ads, which products to push, where the funnel actually bottlenecks) starts from a false data point.
The two classic symptoms are opposite but share the same root cause. Double counting inflates revenue: ROAS looks great but never matches Shopify's own cash register. Missing purchases do the opposite: GA4 shows fewer orders than actually happened, and your campaigns look like they aren't converting. Both come from a setup built in layers, with no single consistent method behind it.
This is a hands-on guide. It tells you which method to pick based on the size of your store, how to set it up step by step, which ecommerce events GA4 needs to receive, and how to verify in fifteen minutes that every purchase is tracked exactly once. No theory: just things you can check today in your own dashboard.

Why Shopify-to-GA4 tracking goes wrong
Before you connect anything, understand where the errors come from. There are three, and you'll find them in almost every case.
1. Checkout changed, and the old scripts stopped working
For years, the standard way to track purchases was pasting gtag code into the thank-you page via checkout's "additional scripts." Since August 2025, Shopify has retired checkout.liquid and additional scripts in favor of Checkout Extensibility. Result: if your tracking still relied on that method, the purchase event simply stopped firing. Plenty of stores lost purchase tracking without noticing for months.
2. You have multiple integrations running at once
Double counting almost always means this: the native Google & YouTube app sends the purchase event, but the theme still has an old hand-written gtag, or a GTM container firing the same event. Two sources, one order, two purchases in GA4, and revenue that never reconciles.
3. Consent isn't wired up
On European traffic, if the cookie banner blocks GA4 but doesn't pass consent signals correctly, events don't fire (or only fire partially). It's not a Shopify bug: it's Consent Mode v2 configured badly, or not configured at all.
Three ways to connect Shopify to GA4
There are three concrete paths. The right one depends on how structured your store is and how much ad budget runs through it.
| Method | Best for | Pros | Cons |
|---|---|---|---|
| Native Google & YouTube app | Small to mid-size stores, first-time setup | Zero code, handles checkout and consent for you | Little customization, events "as-is" |
| Custom Pixel (Customer Events) | Anyone who wants control over events | Full control, runs on checkout, GDPR-compliant sandbox | Requires code and event mapping |
| Server-side (GTM server) | Structured stores, high ad spend | Best resistance to ad-blockers and ITP, cleaner data | Bigger setup and cost |
Rule of thumb: unless you have a specific technical reason to do otherwise, start with the native app. It covers the vast majority of cases, needs no code, and is the only option that handles both checkout events and consent on its own. Move to Custom Pixel or server-side when you need custom events, fine-grained deduplication, or ad-blocker resistance on serious budgets.

Setting up the native Google & YouTube app, step by step
This is the fastest path to clean tracking without touching any code.
- Make sure you already have an active GA4 property. If you're starting from scratch, first create the property and the site's data stream by following the steps to set up GA4 from scratch.
- In your Shopify admin, open the Shopify App Store and install the "Google & YouTube" channel.
- Connect the Google account that owns or manages your GA4 property.
- In the channel's settings, link the correct GA4 property. From this point on, Shopify starts sending ecommerce events.
- Check that no other gtag or GTM container in your theme is sending the same events. If any are, remove them: this must stay the only source.
- Wire up consent through Shopify's Customer Privacy API (native banner or a third-party CMP).
From here on, you don't touch code. If instead you need custom events or want to move away from GTM, the path is the Custom Pixel inside Settings, under Customer Events: there you subscribe to Shopify's standard events (checkout_started, product_added_to_cart, checkout_completed) and translate them into the matching GA4 events.
The ecommerce events GA4 needs to receive
Correct tracking isn't just the purchase event. It's the whole funnel, so you can see where people actually drop off. These are the events GA4 expects from an ecommerce store:
- view_item_list and select_item: product listing and click on a product card.
- view_item: product page view.
- add_to_cart, remove_from_cart, view_cart: cart management.
- begin_checkout: checkout start.
- add_shipping_info and add_payment_info: shipping and payment steps.
- purchase: the order itself, with transaction_id, value, currency, and items populated.
- refund: almost always forgotten. Without it, GA4's revenue stays inflated by returns.
The field that saves everything is transaction_id. It's the order ID. GA4 uses it to recognize the same purchase and avoid counting it twice if the customer reloads the confirmation page or hits back in the browser. If you're seeing inflated revenue with no double integrations active, the first suspect is a purchase event fired without a transaction_id. For the full event-by-event list with the correct parameters, keep a GA4 ecommerce events checklist handy.
Consent Mode v2 and GDPR: not an optional step
If you sell in Italy or Europe, consent isn't a compliance detail to fix "later." Since March 2024, Google has required Consent Mode v2 to use data from users in the European Economic Area (EEA) in audiences and remarketing for Google Ads and GA4. In plain terms: without it, you lose remarketing and a portion of modeled conversions.
On Shopify, the correct flow is this: a consent banner (Shopify's native one or a CMP) hooked into the Customer Privacy API, which passes the ad_storage and analytics_storage signals to Google. The native Google & YouTube app handles this wiring on its own; with Custom Pixel or GTM, you have to wire it yourself. If you're starting from zero on the consent side, it's worth understanding how Consent Mode v2 works before you launch campaigns.
Not sure your Shopify store is tracking every purchase exactly once? Request an audit of your GA4 setup and we'll tell you exactly what to fix.
How to verify it actually works (a 15-minute test)
Connected doesn't mean working. Before you trust the reports, run this check.
- In GA4, open DebugView (Admin, then DebugView) and turn on debug mode with the Google Analytics Debugger extension.
- Browse your store like a customer: open a product page, add it to cart, start checkout.
- Check in DebugView that view_item, add_to_cart, and begin_checkout fire in the right order.
- Place a real test order (even for a minimal amount or with a 100% discount code).
- Confirm the purchase event shows up exactly once, with transaction_id, value, and currency populated.
- Reload the order confirmation page: it must not generate a second purchase event. If it does, you're missing deduplication on transaction_id.
- After 24-48 hours, check Monetization, then Ecommerce purchases, and compare the order count against Shopify.
The realtime report is useful for a quick glance, but DebugView is the only tool that shows you the parameters inside each individual event. That's where the real errors show up.
The 6 most common mistakes (and how to fix them)
| Symptom | Likely cause | How to fix it |
|---|---|---|
| Every purchase counts twice | Two integrations active (native app plus gtag or GTM) | Keep a single source, remove the others |
| Zero purchases for weeks | Tracking still on the old, retired additional scripts | Switch to the native app or the Custom Pixel |
| Revenue higher than real | Purchase events without transaction_id, refreshes counted | Make sure transaction_id is set on every purchase |
| GA4 shows fewer orders than Shopify | Consent blocking, ad-blockers, lost cookies | Consent Mode v2, and consider server-side |
| Revenue doesn't scale with returns | The refund event is missing | Send refund with the same transaction_id |
| Broken sessions or self-referral | Leftover from the old checkout on a different domain | Checkout Extensibility fixes this; check your referral exclusions |
Why GA4 and Shopify will never show the same numbers
Let's put an unnecessary worry to rest. Even with a perfect setup, GA4 will show less revenue than Shopify. That's normal, and the reason is structural: Shopify records every order server-side (it's your source of truth on revenue), while GA4 measures client-side and is subject to denied consent, ad-blockers, lost cookies, and purchases made across multiple devices.
A gap between 5% and 20% is expected. If yours is wider, don't use GA4 for revenue numbers: use it to read behavior (where the funnel stalls, which sources bring the best buyers) and keep Shopify as your cash register. To narrow the gap, the next step is server-side tracking, which sends events from the server and holds up far better against ad-blockers and browser restrictions.
From accurate data to decisions: where this work leads
Tracking well isn't the goal, it's the foundation. Once GA4 receives every purchase exactly once, that data becomes useful in three concrete directions:
- More efficient ads: clean conversions mean reliable optimization and budget that goes where it actually converts, not where it appears to.
- Automations triggered by real behavior: a properly tracked checkout abandonment feeds cart recovery automations that fire on the right event instead of by chance.
- A CRM that speaks the same language: ecommerce events, brought into a CRM built for Shopify, tie the purchase to the customer, not just to an anonymous session.
If you want the full picture on bringing measurement, attribution, and channels together, start with the complete guide to conversion tracking and the overview on ecommerce tracking in 2026. The Shopify-GA4 setup is the first piece: from there, your data stops being a report you glance at and becomes a system that works for you.
Frequently asked questions
Do I still need to install the GA4 gtag code in my Shopify theme?
No. With the native Google & YouTube app or a Custom Pixel, the code in your theme isn't needed, and it's actually the number-one cause of double counting. If you find an old one in theme.liquid or in additional scripts, remove it.
Why does GA4 show fewer purchases than Shopify?
Because GA4 measures client-side and is subject to denied consent, ad-blockers, and lost cookies, while Shopify records every order server-side. A 5-20% gap is normal. Shopify remains the source of truth on revenue.
Is the native Google & YouTube app enough, or do I need GTM?
For most stores, the native app is enough and it also handles consent. GTM, ideally server-side, is worth it when you need custom events, advanced deduplication, or more ad-blocker resistance on high ad spend.
How do I know if I'm double-counting purchases?
Place a test order and check GA4 DebugView: the purchase event should appear exactly once. Then reload the confirmation page. If a second purchase fires, you're missing transaction_id deduplication, or you have two integrations active.
Does the old additional-scripts method still work?
No. Since August 2025, Shopify has retired checkout.liquid and additional scripts. If your purchase tracking still relied on that, the purchase event no longer fires: you need to switch to the native app or a Custom Pixel.
Do I need to set up Consent Mode v2 even if I only use GA4 and don't run ads?
Yes, if you have European traffic. It's needed to collect and model data in a compliant way, and it becomes essential the moment you want to use remarketing or audiences in Google Ads. On Shopify, the native app helps wire it up through the Customer Privacy API.
Want your GA4 data to power automations that recover carts and feed your CRM? Talk to us and we'll design the flow together.