1. Introduction
Shopify has radically changed how tracking works.
Gone are the days when you could drop a script into theme.liquid and call it a day.
Since 2023, Shopify has been replacing checkout.liquid (Shopify Plus) and additional scripts (all plans) with checkout extensions,
eliminating the ability to freely inject JavaScript inside the checkout.
This shift has huge implications:
– Native integrations (Google, Meta, TikTok, etc.) became opaque.
– Custom scripts stopped executing.
– Traditional e-commerce tracking (GA4, Ads, remarketing) broke completely.
2. How Tracking Used to Work
Previously, everything lived inside the theme.
You could embed a Google Tag Manager container, a gtag.js, a Meta pixel, or even a Criteo script —
all directly within theme.liquid or checkout.liquid.
Ecommerce events like add_to_cart or purchase were tracked through DOM listeners or JS snippets.
It was flexible… and hard to secure and to govern.
3. What Changed
With Checkout Extensibility, Shopify introduced a sandboxed model.
Every tracking script now runs in its own isolated environment,
without access to the DOM or checkout code.
This sandbox receives a stream of standardized Customer Events
(such as page_viewed, product_added_to_cart, checkout_completed, etc.),
which you can listen to inside Custom Pixels.
That’s the same model powering Shopify’s native integrations (Google & YouTube, Meta Ads, TikTok, etc.).
But those integrations are closed — you can’t customize the event payloads, the triggers, or attribution logic.
4. Timeline of the Shift
- February 2023 – Early rollout of Checkout Extensibility to Shopify Plus merchants.
Source: tokenoftrust.com – Checkout Liquid Change Shopify
URL: https://tokenoftrust.com/blog/checkout-liquid-change-shopify - August 13, 2024 –
checkout.liquidofficially deprecated for “Information”, “Shipping” and “Payment” pages.
Source: shopify.dev – checkout.liquid
URL: https://shopify.dev/docs/storefronts/themes/architecture/layouts/checkout-liquid - August 28, 2025 (Plus) / August 26, 2026 (non-Plus) –
checkout.liquid, additional scripts and script tags removed from the “Thank you” and “Order status” pages.
Source: shopify.dev – checkout.liquid
URL: https://shopify.dev/docs/storefronts/themes/architecture/layouts/checkout-liquid - 2023–2024 – Rollout of Customer Events and Custom Pixels in the Shopify SDK.
Sources:
– shopify.dev – Web Pixels API (customer events)
URL: https://shopify.dev/docs/api/web-pixels-api
– help.shopify.com – Custom Pixels documentation
URL: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels
– analyticsmania.com – Install Google Tag Manager and GA4 on Shopify (with Custom Pixel)
URL: https://www.analyticsmania.com/post/install-google-tag-manager-and-ga4-on-shopify/
5. Native Integrations: Convenient but Opaque
Shopify offers “native” integrations for:
🎯 Google & YouTube
📱 Meta (Facebook / Instagram)
🎵 TikTok, 📌 Pinterest, 👻 Snapchat, 💼 LinkedIn Ads, 🧠 Reddit
The issue: they’re black boxes.
You can’t inspect what data is sent, when, or how conversions are matched.
Shopify and the platform owner decide everything.
The result:
– risk of duplicates if you also run your own tags
– attribution you can’t audit
6. The Solution: Build Your Own Custom Pixel
Custom Pixels let you rebuild your tracking stack from scratch —
listening to Shopify Customer Events and sending data wherever you want: GTM, your own endpoint, or a partner API.
Your script runs inside a sandbox (no DOM access)
but receives structured event data directly from Shopify’s event stream using analytics.subscribe().
7. Example 1 – page_viewed → Google Analytics 4
Shopify emits a native page_viewed event on every page load.
You can intercept it and push it into the dataLayer.
analytics.subscribe("page_viewed", (event) => {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "page_view",
page_location: event.context.document.location.href,
page_title: event.context.document.title
});
});
This push triggers your GA4 tag inside GTM,
or a server call (/collect?v=2) if you’re running a server-side container.
Sources:
– shopify.dev – Custom Pixels documentation
URL: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels
– analyticsmania.com – Install Google Tag Manager and GA4 on Shopify (with Custom Pixel)
URL: https://www.analyticsmania.com/post/install-google-tag-manager-and-ga4-on-shopify/
– developers.google.com – GA4 Measurement Protocol
URL: https://developers.google.com/analytics/devguides/collection/protocol/ga4
8. Example 2 – Google Ads Conversion Event
To track conversions in Google Ads, you can use the checkout_completed event from Shopify.
Here’s a minimal example sending a conversion via gtag().
analytics.subscribe("checkout_completed", (event) => {
const conversionData = {
send_to: "AW-XXXXXXX/AbCdEfGhIjkLmNo",
value: event.data.checkout.totalPrice?.amount,
currency: event.data.checkout.currencyCode,
transaction_id: event.data.checkout.order?.id
};
gtag("event", "conversion", conversionData);
});
If you’re running server-side tagging,
this same event can be forwarded to your server and uploaded with the Google Ads API (conversion upload).
Sources:
– shopify.dev – checkout_completed event
URL: https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed
– developers.google.com – Google Ads API: conversions overview
URL: https://developers.google.com/google-ads/api/docs/conversions/overview
9. Example 3 – Meta Ads Purchase (Conversions API)
Likewise, you can send a Purchase event to Meta via the Conversions API. A custom pixel runs in the visitor’s browser, so anything in its code is public: never put a Conversions API access token there. The pixel sends the raw event to your own endpoint; your server hashes the email, adds action_source and calls Meta with a server-side token.
analytics.subscribe("checkout_completed", async (event) => {
const payload = {
event_name: "Purchase",
event_time: Math.floor(Date.now() / 1000),
event_id: event.data.checkout.order?.id, // dedup key shared with the browser pixel
event_source_url: event.context.document.location.href,
email: event.data.checkout.email, // raw: hashed on YOUR server, never sent as is to Meta
custom_data: {
currency: event.data.checkout.currencyCode,
value: event.data.checkout.totalPrice?.amount
}
};
// No token here: this code is public. Your server adds action_source: "website",
// hashes the email (sha256 of trimmed, lowercased value) and calls
// graph.facebook.com/<current API version>/<DATASET_ID>/events with a server-side token.
await fetch("https://your-endpoint.example.com/meta-capi", {
method: "POST",
keepalive: true,
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
});
});
Meta requires the email to be hashed (em) and deduplicates browser and server events on event_id.
Sources:
– developers.facebook.com – Conversions API
URL: https://developers.facebook.com/documentation/ads-commerce/conversions-api
– developers.facebook.com – Customer information parameters (hashing)
URL: https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters
– shopify.dev – Custom Pixels documentation
URL: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels
10. Testing and Validation
Because Tag Assistant cannot see tags inside the sandbox, testing must be done differently:
– use the Shopify Pixel Helper (Settings → Customer events → your pixel → Test)
– check Network → collect?v=2 for GA4 requests
– or use GA4 DebugView
Source: help.shopify.com – Testing custom pixels
URL: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/testing
Every time you update your GTM container or pixel code,
you must republish it and verify the payloads via browser dev tools or server logs.
11. Conclusion
Shopify tightened its ecosystem — for good reasons:
security, privacy, and maintainability.
But that same sandbox means you now need to take control again
if you want reliable, granular, and interoperable data.
Customer Events, via app pixels or Custom Pixels, are now the supported way
to integrate GTM, GA4, Meta, or Google Ads in a modern Shopify environment.
No more copy-paste snippets.
Today, your Shopify tracking needs to be coded, tested, and orchestrated.