Available for projects & agency overflow · Quick reply, from the person who does the work

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.

Describe my issue Send a message

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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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

Describe your need in one minute

A few targeted questions so I can reply with an estimate rather than another questionnaire.

outil
api
sens
frequence (facultatif)
Please provide an email or a phone number so I can get back to you.

Please provide an email or a phone number so I can get back to you.

Frequently asked questions

Why doesn’t my GA4 tag in theme.liquid measure purchases any more?
Since Shopify moved to its new checkout system, custom scripts no longer run on the payment and confirmation pages. theme.liquid alone no longer covers the purchase event.
Should I use the Google & YouTube channel or a Custom Pixel?
The official sales channel is the simplest route when it covers what you need. A Custom Pixel gives more control over the events sent, useful when tracking needs fine-tuning.
Does my old Shopify pixel still work?
Since early 2025, Shopify has automatically migrated old pixels not configured through the official channels. I always check a migrated pixel is still reporting correct data.
Do I need consent before loading GA4 on Shopify?
GA4, in its standard configuration, doesn’t meet the CNIL’s exemption criteria. Loading it therefore, in principle, requires the visitor’s prior consent, as on any other platform.
How do I check the whole funnel is tracked?
I place a full test order and check every event in GA4’s DebugView, from the catalogue through to the order status page.