Installing Google Analytics 4 on a Shopify store
On Shopify, adding Google Analytics 4 to theme.liquid is no longer enough to measure purchases. Since Shopify moved to its new checkout system (checkout extensibility), custom scripts can no longer be added to the payment and confirmation pages: the purchase event has to be covered another way.
The situations I handle
- GA4 shows product page views but never a purchase event
- A tag installed in theme.liquid used to work and stopped reporting after a Shopify update
- You’re not sure whether to use the Google & YouTube sales channel or Custom Pixels
- An old pixel was migrated automatically by Shopify and you don’t know if it still works
- You want to check the GA4 install really covers the whole funnel, from catalogue to confirmation
How I install GA4 on Shopify
-
Assessing the legacy location
theme.liquid still covers the catalogue, product pages and cart, but no longer the payment page or the order confirmation page since custom scripts were removed from those pages.
-
Installing via the Google & YouTube channel
Where possible, I connect GA4 through the official Google & YouTube sales channel in the Shopify admin, which handles reporting events including at the payment step.
-
Alternative with a Custom Pixel
In Settings > Customer events, I create a Custom Pixel that listens to Shopify events (page view, add to cart, order placed) and forwards them to GA4 from a sandboxed environment, separate from the theme code.
-
Checking the purchase parameters
I check that transaction_id (the Shopify order ID) and value match the amount actually paid, before calling the purchase event reliable.
-
End-to-end testing
I place a full test order, from catalogue to order status page, and check in GA4 DebugView that every event in the funnel is received.
Why theme.liquid alone is no longer enough
Shopify has moved its checkout to what it calls checkout extensibility. One direct consequence: custom scripts added by hand to the payment and confirmation pages (the old Additional scripts mechanism, or checkout.liquid) are no longer rendered. Shopify announced a 28 August 2025 deadline for phasing out these legacy customisations.
In practice, a GA4 tag installed only in theme.liquid keeps measuring product pages and the cart, but loses the purchase event, the one that matters most for an online shop.
Since early 2025, Shopify has also automatically migrated old pixels that weren’t configured through the official sales channels into custom pixels, with Shopify itself flagging a risk of lost measurement while the migration is checked: I’d recommend checking this on any Shopify account that’s been running for several years.
Related pages
-
Google Tag Manager on Shopify
The same checkout constraint applies to GTM: how I cover it.
-
Ecommerce events that matter
The GA4 events worth tracking first on a purchase funnel.
-
Gap between orders and your measurement tool
Why a gap between real orders and measured conversions is normal, within limits.
-
Shopify, one of my platforms
The other Shopify topics I deal with day to day.
Describe your need in one minute
A few targeted questions so I can reply with an estimate rather than another questionnaire.