Google Tag Manager on Shopify with Custom Pixels
If your Google Tag Manager setup on Shopify was built a few years ago, part of it has probably stopped working. Tracking code used to be pasted into the theme and into checkout's additional scripts box. Shopify has moved checkout tracking to pixels, and the old box is now view-only. This guide explains what changed, how to run Google Tag Manager as a Shopify custom pixel, which events to send, and the limitations you need to plan around before you trust the numbers.
Facts in this article come from Shopify's Help Centre tutorial on Google Tag Manager as a custom pixel, its pixels overview and its checkout upgrade guide, checked on 19 November 2026. Shopify and Google change their documentation often, so check the linked pages before acting on a detail.
Why did Google Tag Manager stop working on Shopify checkout?
Because the place it lived has been retired. Shopify's checkout upgrade guide says that as of 28 August 2025, the additional scripts section in checkout settings is view-only, and scripts there must be replaced on the new pages using built-in features, apps or custom pixels. For stores not on Shopify Plus, the deadline to upgrade existing Thank you and Order status pages was 26 August 2026.
In practice, many stores find that GTM still fires on the storefront, because the container is still in theme.liquid, but purchase and checkout events have gone missing or doubled. Our post on what to check after the checkout deadline covers the wider fallout.
What are Shopify custom pixels and customer events?
Shopify now handles tracking through pixels, managed in Settings > Customer events. There are two kinds:
- App pixels, installed by marketing and analytics apps such as the Google & YouTube app or Meta's app.
- Custom pixels, which a developer adds by hand in the pixels manager.
Pixels listen to customer events that Shopify publishes, such as a product being viewed, added to cart, or a checkout being completed. Shopify says custom pixels let you collect customer events on more pages of your store, including checkout, which theme code cannot reach. Pixels run in a sandbox for security, and Shopify notes that not all pixel functionality works inside it.

How do you set up Google Tag Manager as a Shopify custom pixel?
Shopify's Help Centre gives a step-by-step tutorial. In outline:
- In Google Tag Manager, go to Admin and choose Install Google Tag Manager to get the container code for the head.
- Remove the HTML
<script>tags and keep the code inside them. - In Shopify, go to Settings > Customer events, add a custom pixel, and paste the code.
- In the same pixel, subscribe to Shopify's customer events and push each one into the
dataLayer. - In GTM, create the triggers,
dataLayervariables and tags that use those events. Shopify notes at least one tag and trigger are needed for data to transfer. - Replace any old
dataLayer.pushcalls in your theme withShopify.analytics.publish(), so custom events also flow through the pixel. - Test with the Shopify Pixel Helper.
The code below is illustrative only, to show the structure. Use Shopify's full example from the tutorial as your starting point, because it includes the exact field mapping for each event.
// Illustrative only, based on Shopify's GTM tutorial. Not a complete pixel.
// 1. Paste your GTM container code here, without the <script> tags.
window.dataLayer = window.dataLayer || [];
// 2. Push Shopify customer events into the dataLayer.
analytics.subscribe("product_added_to_cart", (event) => {
window.dataLayer.push({
event: "product_added_to_cart",
// map the fields your GTM tags need from event.data
});
});
analytics.subscribe("checkout_completed", (event) => {
window.dataLayer.push({
event: "checkout_completed",
// map order ID, value and currency from event.data.checkout
});
});
Which events should you send from the pixel?
Shopify's GTM example subscribes to 12 customer events, from page_viewed and product_viewed through checkout_started to checkout_completed. It also maps Shopify's standard event names to GA4's ecommerce names, for example:
| Shopify customer event | GA4 event |
|---|---|
| product_viewed | view_item |
| collection_viewed | view_item_list |
| product_added_to_cart | add_to_cart |
| cart_viewed | view_cart |
| checkout_started | begin_checkout |
| checkout_address_info_submitted | add_shipping_info |
| payment_info_submitted | add_payment_info |
| checkout_completed | purchase |
Send only the events your tags actually use. Every extra event is something else to maintain. For most stores, the essentials are product views, add to cart, checkout started and purchase.
If you need data Shopify's standard events do not include, Shopify says you cannot add custom data to standard events. Publish your own custom event from Liquid with Shopify.analytics.publish() instead, and read it in the pixel from event.customData.

What are the limitations of GTM in a custom pixel?
Plan around these before you promise anyone a perfect setup:
- Sandbox restrictions. Shopify says tag managers in the sandbox face the same restrictions as other pixels. Tags that expect to read or change the page directly may not work.
-
Page URLs. To avoid sandbox details appearing in GA4 page URLs, Shopify's tutorial says to turn off GA4's automatic page tracking and push your own
page_viewedevent with the real page location and title. - Enhanced measurement. Some automatic GA4 events, such as outbound link clicks, cannot fire automatically. They have to be built as custom events.
- Debugging tools. Shopify says Google Tag Assistant's troubleshoot feature is not compatible with custom pixels and does not detect Google tags inside them. Use the Shopify Pixel Helper and GA4's DebugView instead.
- Duplicates. If the Google & YouTube app pixel already sends purchases to Google Ads, and your GTM pixel sends them too, you will double count. Decide which pixel owns which destination.

Photo: Google and YouTube app listing, apps.shopify.com/google
How do consent and privacy affect your pixel?
Shopify's pixels overview says new pixels require Marketing and Analytics permissions by default, and in markets that require consent, such as the EEA and the UK, pixels run only when visitors have given the permissions the pixel needs. Pixels marked as data sale do not run for customers who opted out, unless the pixel supports limited data use.
Shopify's GTM example includes a Google Consent Mode v2 update that sets four signals, ad_storage, analytics_storage, ad_user_data and ad_personalization, to granted. Shopify is clear that this example may not match your region's requirements and that compliance is your responsibility. For Indian stores, our guide to the DPDP Act for Shopify stores explains the consent questions to answer before you copy those settings.
It also helps to decide who owns tracking. On many stores the pixel was added by one agency, the GA4 property belongs to another, and the Meta setup was done by a freelancer who has since moved on. When a number looks wrong, nobody knows where to start. Write down which pixels are installed, who set each one up, which account they send data to, and who has access. Review that list whenever you change agencies or add an app that installs its own pixel, because two pixels sending the same purchase event is one of the most common reasons GA4 and ad platforms report more sales than Shopify.
Keep the custom pixel code itself in version control or at least in a shared document. Keeping a dated copy outside Shopify is the easiest way to see what changed when tracking breaks, and to restore a working version quickly. Add a short note each time you edit it: what changed, why, and who made the change. When a sale starts and the numbers suddenly look odd, that note is often the fastest route to the cause, and it saves an expensive afternoon of guessing between the theme, the pixel and the ad platform.
How do you check that tracking is correct?
- Open the store with the Shopify Pixel Helper and confirm your custom pixel loads and receives events.
- Watch GA4's DebugView while you browse, add to cart and place a test order.
- Compare a week of GA4 purchases with Shopify orders. They will not match exactly, but they should be close. Our guide to GA4 and Shopify numbers that do not match explains the normal gaps.
- Remove the old GTM container and any hard-coded tags from the theme once the pixel is proven, so nothing fires twice.
If you also run Meta ads, the same principle applies to the Meta pixel; our guide to Meta pixel and Conversions API on Shopify covers that side.
If you would rather have tracking set up and checked for you, our guide to a Shopify analytics setup that matters shows what a complete setup should include.
Not sure your tracking survived the checkout upgrade? Email hello@exactwhy.com with the subject "Pixel and GTM check" and your store URL. We will check which pixels are installed in Customer events, look for old tags still in your theme, test your add to cart and purchase events, and tell you what is missing or duplicated, free. If you want us to rebuild the setup, we quote after the check, and ongoing support is available on a monthly retainer. You can also reach us through our contact page. We reply within 4 hours.