GTM in a Shopify custom pixel: why events go missing and what the sandbox can't see.
- “Shopify custom pixel GTM events not firing”
- “GTM not firing on Shopify checkout or thank you page”
- “GTM custom pixel Shopify missing events”
- “Shopify Customer Events sandbox limitations”
- “Shopify custom pixel dataLayer empty”
- “GTM preview mode not working Shopify custom pixel”
- “GA4 page_location shows sandbox URL Shopify”
- “Shopify custom pixel click trigger not working”
Baris Asa, tracking consultant, London · Last checked: November 2026
If GTM runs in a Shopify custom pixel and GA4 shows funnel steps at zero, purchases without revenue or items, or page URLs that aren’t your shop, the pixel’s code didn’t pass that data on. The pixel runs walled off from your site, and Google doesn’t support GTM there. Four breaks cause it: an event never subscribed to, a trigger name that doesn’t match, a trigger type the sandbox blocks, or missing consent.For GA4 and Google Ads alone, Google recommends the Google & YouTube app instead (Google: custom pixel limitations). Which app or pixel should send what is in Shopify tracking apps: what each one sends. Not the person who edits the pixel? Do the check below, then skip to the decision.
Is this your store? A three-minute check
You need Shopify admin and GA4. No code.
- Two senders. Settings, Customer events: look for a custom pixel with
GTM-in its code. Then check whether the Google & YouTube app sends to the same GA4 property. Fault if: both send the same events, such as purchase or page_view. That double counts. - A broken pixel. Open the pixel and click Test. Browse to a product, add it to the cart, go to checkout. Fault if: a red dot appears, or “Pixel is awaiting consent” stays after you accept the banner.
- Missing purchases. For the same 7 days, compare purchases in GA4 (Reports, Monetisation) with orders in Shopify Analytics. Fault if: GA4 shows orders with zero or blank revenue, or GA4 is 10% or more below Shopify. Shopify says some bots never trigger the sandbox, so single-digit percentage dips are expected (Shopify: pixel migration). Past that, I look for a cause.
- An empty funnel step. In the same GA4 report, look at views, add-to-carts and checkouts. Fault if: any step is at zero while orders come in.
If a check fails, the next two sections are the brief for whoever maintains the pixel. If nobody owns the pixel, that is the first finding.
Why GTM events go missing in a Shopify custom pixel
How the pixel works, in one line: its code asks Shopify for each event (analytics.subscribe), then hands it to GTM (dataLayer.push). Anything not handed over doesn’t exist for GTM. Four causes, in the order I check them. The first two need only the pixel code and the GTM container.
1. The pixel never subscribes to the event.
Look first at the checkout steps. Each needs its own subscribe line and its own GA4 tag: Shopify’s mapping table pairs checkout_address_info_submitted with add_shipping_info and payment_info_submitted with add_payment_info. Shopify’s own GTM example skips product_removed_from_cart. List every analytics.subscribe line and compare it with your funnel.
Signature: a step is empty in GA4 and absent from the Pixel Helper log. On file as F-301 .
2. The trigger name doesn’t match the push.
The pixel pushes, say, event: "checkout_completed". The GTM Custom Event trigger’s event name must match that key exactly (Shopify: GTM custom pixel). The GA4 tag then sends it under GA4’s name, purchase. A trigger left on a page-load type can fire before the push arrives: that timing break is F-103 , covered in GTM tag fires before the dataLayer is ready.
Signature: the event shows in the Pixel Helper but never reaches GA4.
3. The trigger type can’t work in the sandbox.
Preview mode, “many trigger types” and many variables may not work there (Google). The sandbox also can’t read outbound link clicks, page scrolling or heatmap-style clicks off the page (Shopify).
Fix: subscribe to Shopify’s own clicked and form_submitted events, or publish custom events from the theme, and push those to GTM. That covers clicks and form submits, not scroll depth, and not on the Order status or customer account pages.
4. The pixel never got consent. Where your store’s privacy settings require consent (usually the UK and EEA), a pixel runs only after the visitor grants the permissions set in its configuration, Marketing and Analytics by default (Shopify). A third-party cookie banner has to pass the visitor’s choice to Shopify, or the pixel may not fire even after “Accept” (Shopify: testing). Fix: connect the banner to Shopify’s Customer Privacy API, so a visitor’s Accept reaches the pixel.
Only the purchase is missing? checkout_completed fires once per checkout, usually on the Thank you page. With a post-purchase upsell it fires on the first upsell page instead, and not again on the Thank you page. If that page fails to load, it never fires (Shopify: checkout_completed). A trigger that also checks for a thank-you URL misses every upsell order. For a purchase at zero from any cause, see GA4 purchase event not firing.
Why the event reaches GA4 without value, items or the real URL
The event fires but the report is wrong.
- The field was never mapped. The pixel pushes only the fields you write. GA4 needs
valueas a number,currencywhenevervalueis set, anditem_idoritem_nameon each item (Google: missing ecommerce data). Shopify’s line items aren’t in that format, so the pixel has to rebuild each one. Full field checks: GA4 purchase missing items or value. Item format in GTM: GA4 ecommerce dataLayer in GTM. - The path is wrong. Shopify’s data is nested. Revenue is
event.data?.checkout?.totalPrice?.amount, notevent.data.value. A wrong path givesundefinedwith no error. - The example was pasted as is. Shopify’s GTM example sets
currencyonproduct_added_to_carttoevent.data?.cartLine?.merchandise?.id, the variant ID. Its shortcheckout_completedexample pushestotalTaxas a money object, not itsamount. Read every line before pasting. - The page URL is the sandbox’s. Automatic page URL detection in the sandbox returns a sandbox version. Shopify’s fix: turn off GA4’s automatic page view. Push your own
page_viewedwithevent.context.window.location.hrefandevent.context.document.title. Send them aspage_locationandpage_titleon a GA4 page_view event tag. I go one step further. Set the samepage_locationon every other GA4 event tag, or purchases keep the sandbox URL. Passpage_referrerfromevent.context.document.referrerthe same way. - The feature needs the real page. Enhanced conversions, cross-domain measurement and consent mode URL passthrough may not work from the sandbox, in GA4 and Google Ads (Google).
- Personal data went too far. Shopify’s example pushes email, phone and address into the dataLayer on checkout events. Map none of it to a GA4 parameter. Google’s policies say nothing Google could recognise as personally identifiable, such as an email address, may be passed to it (Google: avoid sending PII). On file as F-603 .
What the Shopify sandbox can and can’t see
A custom pixel runs in an iframe (a page inside the page) that can’t reach the real shop page (Shopify: sandbox environments). The tags GTM loads run inside it too. Pixels load on the storefront, checkout, Thank you and Order status pages, and on customer account pages once a custom subdomain is connected (page_viewed only).
Why so many stores ended up here: Shopify’s developer docs say checkout.liquid and Additional Scripts were sunset on the Thank you and Order status pages on 28 August 2025, and script tags on those pages for non-Plus stores on 26 August 2026. Check your own plan’s dates in Shopify admin (Shopify: checkout.liquid).
| GTM can receive | GTM can’t rely on |
|---|---|
Standard events the pixel subscribes to, from page_viewed to checkout_completed | The theme’s dataLayer |
Custom events the theme publishes with Shopify.analytics.publish | Anything read off the page: form fields, prices, email |
Shopify’s clicked and form_submitted events (storefront, checkout, Thank you only) | GTM’s own click, scroll and visibility triggers |
| A cart and customer snapshot at page load, cookies via Shopify’s browser API | The real page URL, without the fix above |
Shopify lists its standard events in the standard events reference. Its DOM events don’t run on the Order status page or customer account pages (Shopify: DOM events).
How to test a GTM custom pixel without Preview mode
Tag Assistant’s Troubleshoot tag feature isn’t compatible with custom pixels and doesn’t detect Google tags in one (Shopify: GTM custom pixel). Test from Shopify, then the network, then GA4.
- Development store first. On a live store, publish at a quiet time and keep the previous container version ready to roll back.
- Shopify Pixel Helper. Settings, Customer events, your pixel, Test. Walk to a test order. Green dot: the event arrived and your code ran. Red dot: your code threw an error; expand it to read it. The log clears on every page and covers one pixel at a time (Shopify: testing).
- Network panel. DevTools, Network, Preserve log on, filter on
collect. Each GA4 request’senparameter is the event name. No request: the push or trigger failed. Empty values: a mapping failed. - GA4 DebugView. Set
debug_mode: trueon the GA4 tags while testing and watch Admin, Data display, DebugView. If nothing shows, trust the Network panel. Removedebug_modebefore you publish for good (Google: DebugView). - The sandbox console. In Chrome’s Console, switch the context menu to the pixel’s sandbox iframe. Your
console.loglines appear there, and typingdataLayershows every push the pixel made.
A pass: every funnel step has a green dot and one GA4 request, and a test purchase reaches GA4 with the order ID, value, currency and items you expected.
Keep GTM in the pixel, rewrite it, or replace it?
For GA4 and Google Ads on Shopify, the supported route is the Google & YouTube app. GTM in a custom pixel is unsupported by Google and earns its place only for tags the apps don’t provide. For Meta, Shopify points to the Facebook & Instagram channel for the most accurate tracking (Shopify: pixel migration).
An audit of this setup ends in one of three calls:
- Replace. GA4 and Google Ads only: move to the app. I do that as Shopify tracking setup: list what sends today, keep one sender per platform. Switching means removing the GTM purchase tag the day the app goes live, re-pointing Google Ads conversion actions and finding a home for any other tags. Done out of order, purchases double count or stop.
- Rewrite. You need tags the apps don’t cover: keep GTM, but write the pixel from scratch rather than patching a pasted example.
- Move server-side. Browser limits are the real problem: the routes are in Shopify server-side tracking compared.
Making that call, and the rewrite when it’s the answer, is the work I do as a Google Tag Manager consultant for Shopify brands and their agencies.
A pixel nobody remembers writing may be one Shopify made. In February 2025 it converted Meta pixels and Google Universal Analytics tags not set up through their apps into custom pixels (Shopify: pixel migration).
Common questions
Why are some events missing when GTM runs in a Shopify custom pixel?
GTM only receives what the pixel’s code asks Shopify for and passes on. The four usual breaks: the pixel never subscribes to the event, the GTM trigger name doesn’t match the push, the trigger type can’t work in the sandbox, or the pixel never received consent.
Can a Shopify custom pixel read my theme’s dataLayer?
No. Shopify runs custom pixels in an iframe that can’t reach the shop page. Theme data gets in mainly as a Shopify standard event or as a custom event published with Shopify.analytics.publish and subscribed to in the pixel.
Does GTM Preview mode work with a Shopify custom pixel?
Google lists Preview mode among the features that may not work there, and Shopify says Tag Assistant doesn’t detect Google tags in a custom pixel. Test with the Shopify Pixel Helper, the Network panel and GA4 DebugView instead.
Why does GA4 show a strange page URL from my Shopify custom pixel?
Inside the sandbox, automatic page URL detection returns a sandbox version. Shopify’s fix is to push the real URL and title from its page_viewed event and send them on a GA4 page_view tag; I set the same page_location on every other GA4 event tag too.
What is the supported way to track GA4 and Google Ads on Shopify?
The Google & YouTube app. Google says running Google tags or GTM inside a Shopify custom pixel is not a supported implementation and that its support can’t help with it.
Sources
Read on 8 November 2026:
- Shopify Help Center, pixels overview (pages where pixels load, customer accounts with a custom subdomain, sandbox limitations list, sandbox page URL, GTM-loaded pixels run in the sandbox, UK/EEA consent, Marketing and Analytics by default)
- Shopify Help Center, create a Google Tag Manager custom pixel (subscribe and push to
dataLayer, example payload and itscurrencyandtotalTaxlines, Custom Event trigger name must match the key, mapping table to GA4 events, cleaner page URLs withpage_locationandpage_title, Tag Assistant not compatible) - Shopify Help Center, testing custom pixels (Pixel Helper steps and limits, green and red dots, consent sync through the Customer Privacy API, console in the sandbox iframe)
- Shopify Help Center, pixel migration (February 2025 conversion of Meta pixels and Google Universal Analytics tags, Facebook & Instagram and Google & YouTube channels for the most accurate tracking, single-digit dips from bots)
- Shopify developer docs, web pixels and sandbox environments, standard events, checkout_completed, DOM events, checkout.liquid (sunset dates for the Thank you and Order status pages)
- Google Analytics Help, missing ecommerce data, avoid sending personally identifiable information, DebugView
- Google Tag Manager Help, limitations of using a custom pixel for conversion measurement on Shopify (not a supported implementation, feature lists for Google Ads, GA4, the Google tag and Tag Manager, Google & YouTube app can’t host GTM)