Shopify GA4 tracking and GTM setup
Shopify's checkout doesn't run your theme's code, so a pasted GTM container goes dark at payment. Marc Alexander builds GTM and GA4 across storefront and checkout, on Shopify's customer events.
What gets built.
- GTM in the theme, fed by a structured, documented dataLayer.
- A customer events pixel that tracks the checkout through to purchase.
- Every GA4 ecommerce event, with item data mapped to your catalogue.
- Custom events for quizzes, configurators, bundles and infinite scroll.
- Consent Mode v2 in both the theme and the checkout pixel.
- Referral settings for PayPal, Klarna and 3D Secure, checked against orders.
- Google Ads, Meta, TikTok and Pinterest from the same dataLayer, if needed.
How it works.
Discovery
A short call and access to GA4, GTM and the Shopify admin. Marc maps what fires now, where and why.
Specification
A written spec of every event, parameter and trigger, including subscription and upsell apps, agreed before anything is built.
Build and validate
Storefront, checkout pixel and consent built, real orders traced end to end, and GA4 reconciled against the Shopify admin.
Handover
A walkthrough and full documentation. Most builds take 2 to 4 weeks, depending on access and ad platforms in scope.
Related work.
- Current setup might be salvageable? A GA4 mini audit, from £175, checks it first. Audit and fix is from £1,000.
- Other platforms, and why ecommerce tracking breaks: GA4 for ecommerce.
- Google Ads and Meta conversions from the same build: conversion tracking.
More detail: why the native apps fall short, and the checkout sandbox
No customisation
The Google & YouTube, Meta and TikTok apps each send a fixed set of events. You can't add parameters, fix item data or debug them when the numbers look wrong.
No shared source
Each app measures separately, with its own definitions and timing. When GA4, Google Ads and Meta disagree, there's no common dataLayer to settle it.
A fixed idea of your store
They assume collection, product, cart, checkout, purchase. Quiz-led funnels, product builders and subscription-first stores have steps the apps can't describe.
Little consent control
Each app handles Consent Mode v2 its own way, with little visibility, which matters under UK GDPR and PECR.
Since Shopify retired checkout.liquid, custom code in your theme, including the GTM snippet, doesn't run at checkout. The checkout is a sandbox, and tracking not built for it stops at begin_checkout.
So the build has two parts sharing one schema: GTM in the theme, with a bridge from Shopify's analytics events so each event carries full product data, and a customer events pixel sending begin_checkout, add_shipping_info, add_payment_info and purchase with item, revenue, tax and shipping data.
The sandbox has real limits (no GTM preview mode, restricted triggers, no DOM access). Marc has built both conventional storefronts and a fully bespoke ecommerce journey, from quiz-led onboarding to purchase. See also cross-domain tracking.
Straight answers.
Can you use Google Tag Manager with Shopify?
Yes, and for any store running paid media or needing more than basic reports, you should. It takes two parts: the GTM container in your theme for the storefront, and a customer events pixel for the checkout, because theme code doesn't run there.
Do I still need the Google & YouTube app?
Not for tracking. The GTM setup replaces its GA4 and Google Ads conversion tracking, and running both usually means counting orders twice. Many stores keep the app for Merchant Center product feeds with its tracking switched off. The same goes for the Meta and TikTok apps once GTM handles those platforms.
Does this work with Shopify Plus?
Yes. Plus stores get the same build, with extra attention to checkout extensibility, B2B flows and multiple storefronts where they apply.
What about subscription and upsell apps?
Recharge, post-purchase upsells and similar apps each affect tracking in their own way. They're mapped during discovery and written into the spec, so they're handled before launch rather than found afterwards.
Will GTM slow my store down?
It shouldn't. The storefront build is kept light, and most stores lose page weight because redundant tracking apps and duplicate pixels are removed.
Do I need server-side tracking?
Not necessarily. A well-built browser setup with Consent Mode v2 is right for many stores. Server-side earns its keep when paid spend is significant and Meta needs a Conversions API feed. The native apps have no route to it, so a proper GTM foundation comes first either way. See server-side GTM.
If your GA4 checkout events stop at begin_checkout, this build is the fix.
Last updated
Free tool
What does your site fire before consent?
Paste a page address. The tracking checker shows what a first-time visitor triggers before agreeing to anything, ranked by how much it matters.
Related work.
Talk to Marc about it.
Tell Marc what's happening with your tracking. The quickest place to start is usually a GA4 mini audit: a prioritised list of what's broken and what to fix first.
Mini audit from £175.
Prefer to talk first? Choose "20-minute intro call" in the form.
Or email [email protected].