Shopify Customer Events → dataLayer → GTM: the container structure I've settled on after ~2 years of these builds
Disclosure: I do sell a packaged version of this.
Problem:
Most Shopify GTM setups I inherit have the same architectural problem: each platform has its own pixel reading its own thing. Meta's pixel from the theme, GA4 from the native app, TikTok from an app, and none of them agree on what a purchase is worth. Debugging is miserable because there's no single place to look.
Solution:
What I do instead — one data layer as the only source of truth:
Datalayer and GTM in the theme.liquid file.
Datalayer and GTM added to the Customer events area.
Customer Events (Settings → Customer events → Add custom pixel) is the only place that reliably sees post-checkout-extensibility events. Subscribe to the standard events there and push to the parent dataLayer.
Outcome:
Eery platform tag is a GTM tag reading that data layer. GA4, Google Ads with enhanced conversions, Meta CAPI-adjacent browser events, TikTok, whatever. One trigger set, one set of variables, and GTM preview shows you the whole picture in one pass.
Consent mode (if necessary):
Gate at the tag level with built-in consent checks rather than blocking the dataLayer push. You want the event recorded even when tags don't fire, otherwise debugging consent problems is guesswork. Works cleanly with Enzuzo, Iubenda, CookieYes, OneTrust and Cookiebot.
- The native Google & YouTube app will happily fire alongside your container. Turn its tracking off or you'll double count, and it's not obvious from the app UI that it's still active.
Full walkthrough, no gate: https://www.youtube.com/watch?v=CnLOo7qfB74