Shopify GA4 tracking now runs through customer events: either the Google & YouTube app sends GA4 events for you, or a custom pixel subscribes to Shopify's standard events and pushes them into Google Tag Manager. Checkout scripts in checkout.liquid and Additional scripts no longer run on the Thank you and Order status pages, so purchase tracking must come from the checkout_completed event. Pick one source for each GA4 event, send value and currency with every purchase, and set the pixel's customer privacy settings to match your consent banner.
Shopify GA4 tracking changed more in the last two years than in the decade before. The checkout no longer runs your scripts, Google Tag Manager has moved into a sandbox, and many stores now send purchases from two places without knowing it. This page explains how tracking works on Shopify today, the mistakes we see most often, and how to set up Shopify Google Tag Manager and GA4 so that every order is counted once, with the right revenue.
How Shopify GA4 tracking works today
Shopify routes tracking through customer events. Shopify emits standard events such as page_viewed, product_viewed, product_added_to_cart, checkout_started and checkout_completed, and pixels subscribe to them. There are two kinds:
- App pixels, installed by apps such as the Google & YouTube app or Meta's app.
- Custom pixels, code you paste under Settings > Customer events in the Shopify admin.
Both run in a sandbox. A custom pixel cannot read the page around it, so it only knows what Shopify passes in each event. That is a deliberate security measure, and Shopify offers no way to bypass it.
The Google & YouTube app
The app connects a GA4 property to the store and sends ecommerce events without code. Google's help lists events such as view_item_list for collection pages, remove_from_cart, view_cart and add_shipping_info during checkout. It is the fastest route for a store that only needs GA4 and Google Ads, but you get Shopify's choice of parameters and naming, and allow 24 to 48 hours before data appears.
What changed for checkout scripts
Shopify deprecated checkout.liquid in 2023 and then sunset it, together with Additional scripts and app script tags, on the Thank you and Order status pages: on 28 August 2025 for Plus stores and on 26 August 2026 for other plans. Automatic upgrades remove those customisations. Any purchase tag that used to sit in Additional scripts is gone, and the replacement is the checkout_completed event in an app pixel or a custom pixel. Shopify documents that event as triggered once for each checkout, typically on the Thank you page.
The common mistakes
| Mistake | What you see | Cause |
|---|---|---|
| Double purchases | GA4 purchases above Shopify orders | The Google & YouTube app and a GTM custom pixel both send purchase to the same property, or GTM loads in the theme and in a pixel |
| Missing value or currency | Purchases with zero revenue, or revenue in the wrong currency | value sent without currency, or the amount sent as a string from a hand-written pixel |
| Different order IDs | Duplicates GA4 cannot merge | One source sends the order name (#1001), another sends the order ID |
| Consent mismatch | Sharp drop in EU events, or tracking before consent | Pixel privacy settings do not match the banner, or Consent Mode is not wired up in GTM |
| Leftover theme code | Old Universal Analytics or gtag snippets still firing | Code in theme.liquid that was never removed after moving to pixels |
Google's ecommerce reference is explicit that currency is required when value is set, and GA4 only deduplicates purchases from the same user with the same transaction ID. Both points matter more on Shopify than elsewhere, because two installations are so easy to end up with. To find and fix doubles, see duplicate purchase events in GA4.
Consent on Shopify
Each custom pixel has customer privacy settings. By default, a new custom pixel requires Marketing and Analytics permission and counts as data sale. If the store has no cookie banner that collects that permission, the pixel's behaviour will not match what you expect. Decide which purposes the pixel needs, set the permission to match, and still configure Consent Mode inside GTM so Google tags receive the right consent state. Our Consent Mode v2 checklist covers the GTM side.
How to set up Shopify Google Tag Manager and GA4
This is the route when you want full control. If you only need the basics, the Google & YouTube app is a valid choice: use one or the other per GA4 property, not both.
- Inventory what already sends data. Check the Google & YouTube app's GA4 connection, other app pixels,
theme.liquidand any leftover Additional scripts. Write down every place that sends to GA4 or Google Ads. - Create the custom pixel. In Settings > Customer events, add a custom pixel, paste the GTM container code as Shopify's tutorial describes, and set its privacy permissions.
- Subscribe to standard events and push GA4-shaped data. Map Shopify's events to GA4 ecommerce events in the pixel, so the GTM side stays simple.
- Build GTM tags. One GA4 event tag per ecommerce event, a Custom Event trigger per event name, and dataLayer variables for the
ecommercefields. - Remove the duplicate source. Disconnect GA4 events in the app, or remove the old theme snippet, before publishing.
- Test a real order. Watch GA4 DebugView and the network requests. GTM Preview is limited here, because the dataLayer lives inside the pixel's iframe; Shopify notes you can inspect it in the console by selecting the pixel's context.
A minimal purchase mapping inside the custom pixel looks like this:
window.dataLayer = window.dataLayer || [];
analytics.subscribe("checkout_completed", (event) => {
const checkout = event.data.checkout;
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: checkout.order?.id,
value: Number(checkout.totalPrice?.amount),
currency: checkout.currencyCode,
items: checkout.lineItems.map((item) => ({
item_id: item.variant?.sku,
item_name: item.title,
price: Number(item.variant?.price?.amount),
quantity: item.quantity
}))
}
});
});The order ID is only filled on checkout_completed; Shopify returns null for it on earlier checkout events. Whatever ID you choose, use the same one in every tag that reports the purchase, including Google Ads and the Meta pixel, so deduplication works downstream. If you also send enhanced conversions to Google Ads, build them on the same event.
Shopify conversion tracking for Google Ads
For Shopify conversion tracking in Google Ads, count each purchase once as a primary conversion. Either import the GA4 purchase key event or use a Google Ads conversion tag with the transaction ID, and make the other secondary. Pass the same order ID to the Google Ads tag so its own deduplication works. Only primary actions feed bidding, so this is the one that changes how your budget is spent.
What Tracking Whisper does on a Shopify store
Tracking Whisper does not connect to your Shopify account and does not edit the theme or the pixel. It works through the parts of the setup that live in Google's tools and on the site itself:
- Audit. It runs a fixed set of checks on the GTM container, flags duplicate GA4 configurations, tags without currency, and triggers that can fire twice. See the GTM audit.
- Build. It creates the GA4 tags, triggers and variables in its own GTM workspace, and publishes only after a person approves the version.
- Pixel guide. Because the custom pixel lives in Shopify's admin, it writes the pixel mapping and a dataLayer guide for you or your developer to paste in.
- Browser checks. It opens key pages in a real browser and checks the dataLayer, the hits and the consent state.
- Monitoring. It watches container versions and GA4 numbers, and alerts when purchases stop or leave their usual range. See monitoring.
Next step
Connect your GTM container and GA4 property to Tracking Whisper and run an audit of your Shopify setup; the free plan covers one client with read-only Tag Manager access. When you are ready to fix what it finds, start a tracking setup.
Frequently asked questions
Can I still add Google Tag Manager to Shopify's theme.liquid?
You can load GTM in the theme for storefront pages, but it does not run in checkout. Shopify's own guidance for an upgraded checkout is to load GTM in a custom pixel under Settings, Customer events, and push events to the dataLayer from there. Loading GTM in both places means two containers on storefront pages, which is a common cause of double events.
Should I use the Google & YouTube app or GTM for Shopify GA4 tracking?
Either works, but not both for the same events. The app is the quickest route and sends ecommerce events such as view_item_list, view_cart and add_shipping_info without code. GTM in a custom pixel gives you control over parameters, extra tags and naming. If you choose GTM, do not also connect the same GA4 property in the app.
Why does GTM Preview not show my Shopify checkout events?
Custom pixels run in a sandbox iframe, so the dataLayer exists inside that iframe and not on the top page. Shopify notes that you can still inspect it in the browser console by selecting the pixel's JavaScript context. Check the GA4 DebugView and the network requests as well as Tag Assistant.
Does checkout_completed fire again when the customer reloads the Thank you page?
Shopify documents checkout_completed as triggered once for each checkout, typically on the Thank you page. Duplicates on Shopify usually come from two sources sending the same purchase, such as the app and a custom pixel, rather than from reloads.
What happened to Additional scripts on the order status page?
Shopify sunset checkout.liquid, Additional scripts and script tags on the Thank you and Order status pages: on 28 August 2025 for Plus stores and on 26 August 2026 for other plans, with automatic upgrades removing those customisations. Tracking that lived there has to be rebuilt as an app pixel or a custom pixel.
Sources
Last updated by Dimitris.