How to Add Google Tag Manager to a Shopify Store in 2026, and What It Can't See

|Dan Giura
How to Add Google Tag Manager to a Shopify Store in 2026, and What It Can't See

TL;DR

Google doesn't support running its tags inside Shopify's custom pixel [4]. The install is short either way. The harder part is knowing what the container can't see in the sandbox, and making sure the purchase is sent once.

Key Takeaways

  • Shopify's GTM page names the custom pixel as the route and doesn't mention theme code [1]. Google tells you to move Google tags out of containers on Shopify sites [4].
  • The 2027-03-01 script tag stop concerns script tag records. None of the pages cited here apply it to code pasted into your theme [7].
  • In a custom pixel, GTM runs in an iframe with no access to the top frame [5].
  • Shopify's DOM events cover clicked, form_submitted and three input events, with no scroll event [9].
  • Google says GA4 deduplicates purchase events with the same transaction ID [8], and says nothing about two different senders. Keep one purchase sender per destination.
  • Test with one order in GA4 DebugView and read the transaction IDs.

Where can Google Tag Manager live on a Shopify store in 2026?

Four sources speak to it, and each answers a different question. Read them as a table, not as one policy.

Source What it says about GTM or its neighbours What it leaves out
Shopify's GTM help page [1] GTM is available to all stores with a custom web pixel. It doesn't replace Google Analytics. Adding GA through GTM next to the built-in Google integration can duplicate tracking. Theme code.
Shopify's pixel-migration page [3] Names theme.liquid as a place old pixels live and lists benefits of migrating pixels added there to an app pixel or a custom pixel. Says to confirm each event is tracked only once. Anything specific to a GTM container.
Google's custom pixel page [4] Running Google tags inside the custom pixel is "not a supported implementation". Google support can't help troubleshoot it. Move Google tags out of Tag Manager containers on Shopify sites; GTM can't be set up through the Google & YouTube app. Whether a container in theme code is "unsupported"; that line names the custom pixel.
Shopify's script tag page [7] After 2027-03-01 "leftover script tag records will have no effect". Code in your theme.

Shopify's own tutorial says "Adding and using custom pixels is unsupported by Shopify" [2]. The route Shopify documents is one neither company will troubleshoot.

On the script tag point, the dates are these. Creating or updating storefront script tags was blocked from 2026-10-01, which has passed; Shopify stops injecting them on 2027-03-01 [7]. Script tags on the Order status page stopped running for non-Plus stores on 2026-08-26 [11]. Those are records created through the ScriptTag API. A container pasted into a theme file is a file edit. Shopify's page says "A script in theme code stays there after the app is gone, and editing theme code takes the theme off its automatic upgrade path, so only do this when the app can't use app extensions" [7], and I found no Shopify page that applies the stop to theme code. The deadline itself is covered in what Shopify's script tag deprecation means for tracking.

Container ID classes are covered in GTM- versus G- container IDs on Shopify, and server-side containers, a separate product, in what server-side Google Tag Manager is on Shopify.

How do you add Google Tag Manager to a Shopify store?

Create the container in GTM first and keep its install box open. It gives you two parts: a <script> for the <head> and a <noscript> for just after <body> [15]. Then pick a home.

Storefront pages, in theme code

  1. In the theme's code editor, open theme.liquid. Shopify notes that editing theme code takes the theme off its automatic upgrade path [7].
  2. Paste the <script> part in the <head>.
  3. Paste the <noscript> part right after the opening <body> tag.
  4. Save, then publish a tag in GTM and load a storefront page.

Checkout and storefront, in a custom pixel

  1. Go to Settings > Customer events > Custom pixels and add a pixel.
  2. Take the <script> from the install box, remove the HTML tags and paste what's left into the pixel [2]. The <noscript> part isn't used.
  3. Subscribe to the customer events you want and push them to the dataLayer, as Shopify's tutorial describes [2].
  4. In GTM, create at least one tag and one trigger. Shopify says data transfer doesn't occur without them [2].
  5. Set the pixel's Permission to Required or Not required on purpose, since Shopify says consent compliance is your responsibility [10].
  6. Connect the pixel, and confirm events arrive with the Shopify Pixel Helper, which the tutorial points to [2].

If the same container is already in your theme, remove that copy or make sure no tag fires in both; Shopify's migration page says to confirm each event is tracked only once [3].

What can Google Tag Manager not see inside a Shopify custom pixel?

A custom pixel is a lax sandbox: an iframe with the sandbox attribute set to allow-scripts and allow-forms, with no access to the top frame [5]. Shopify's docs say window.href returns the sandbox URL instead of the top frame URL (Shopify's spelling) [5]. A trigger or variable that reads the page URL would read the wrong string, which makes it the first thing I'd check. That is my reading of the docs, not a line from either company.

The theme-code home is ordinary page code on your storefront. For upgraded checkout, Shopify's GTM page sends you to the custom pixel tutorial instead [1]. The Meta side of that split is in Meta pixel through GTM on Shopify.

Home What runs Where it's blind
Theme code The container as page script Checkout; Shopify routes upgraded checkout to the pixel [1]
Custom pixel The container inside an iframe sandbox The page itself and the top frame [5]

Google's list for the sandbox reads, in its words, that these "may not work correctly" [4]:

  • Tag Manager Preview mode, "Many trigger types", "Many built-in variables" and "Many user-defined variables"
  • Third-party tags that modify the DOM
  • Tag coverage summary and Tag Diagnostics
  • For Google Ads, Analytics and the Google tag: enhanced conversions, cross-domain measurement, consent mode URL passthrough and Tag Assistant

Google doesn't name click or scroll triggers on that page, so I won't. What Shopify gives you in their place is its DOM events API: clicked, form_submitted, input_blurred, input_changed and input_focused, available on storefront, checkout and Thank you pages and not on Customer Accounts pages or the Order status page shown after Thank you [9]. Scroll isn't in that list.

How do theme code and a pixel container talk to each other?

Shopify built a bridge for the gap. From a <script> in theme.liquid you publish a custom event, and a subscriber in the pixel receives it in customData [6]. Shopify's documented call, shown here as an illustration with a placeholder name:

Shopify.analytics.publish('my_store:event_name', event_data)

Shopify says partners and merchants can't publish standard events, and that custom events should carry a prefix [6]. It also says custom events "can be published by users, other developers and even visitors from their browser console" and to be mindful when processing them [6].

So the working rule is a split. Keep storefront-DOM logic in theme code, keep checkout in the pixel, and connect the two only with published custom events. And don't hang anything revenue-bearing on a custom event, because a visitor with a console can fire it.

Who should own the purchase event when GTM and an app both run?

You've probably opened a GA4 report, seen more purchases than Shopify orders, and gone looking for the extra one. Start by listing every sender.

Sender Where it runs What to check
A purchase tag in your container Theme code or the custom pixel Which variable fills transaction_id
Shopify's built-in Google Analytics integration Shopify Shopify warns that adding GA through GTM next to it can duplicate tracking [1]
Leftover code in your theme Your theme files Search for GTM- and googletagmanager.com, as Google's cleanup page suggests [15]
An app's purchase Depends on the app Where it fires, and what ID it uses

Google's own Shopify setup page says to remove legacy tags to prevent duplicate measurement [13]. Its dedup rule is short: GA4 "deduplicates purchase events with the same transaction ID" [8]. The page says nothing about which of two events is kept, about Measurement Protocol, or about a time window. So don't assume a container purchase tag and an app's purchase will merge. Google's page doesn't say whether a purchase from two different senders merges even when the IDs match.

On the pixel side, checkout_completed fires once per checkout, typically on the Thank you page, and not at all if that page fails to load. data.checkout.order.id is the order's ID [12].

Here is where WeltPixel Conversion Tracking sits, since people ask. The app loads Google's gtag tag on your storefront. It doesn't install or use a Tag Manager container. It sends the storefront page view itself. A GA4 tag in your container that also sends a page view to the same measurement ID would likely add a second one per load, so count them in DebugView. The app sends the purchase from the order Shopify creates, not from the browser, and keys the GA4 purchase to the Shopify order ID. The free plan is GA4 only, up to 100 storefront orders a month [14].

The rule that follows is one owner per destination. If an app sends your GA4 purchase from the order, the container keeps its non-purchase work and the purchase tag comes out. If the container owns it, the app shouldn't also send it. Pick one and write down which. Event IDs and the Google Ads conversion-action overlap each have their own articles: event deduplication on Shopify and running a tracking app alongside Shopify's Google and YouTube channel.

How do you check that nothing fires twice?

Place one test order. Open GA4 DebugView and follow the GA4 DebugView check for Shopify events while it runs. DebugView only shows events sent in debug mode [16]: set debug_mode to true in the container's GA4 tag, and if you run WeltPixel Conversion Tracking, turn on Advanced Settings > Google Analytics 4 Settings > Enable Debug Mode, which also marks its server purchase. Then:

  1. Count the purchase hits for that order. One is the target.
  2. If you see two, open both and compare transaction_id character for character. I haven't confirmed which format your container variable returns, so read it, don't assume it.
  3. Count page_view hits per page load the same way.
  4. Remove one sender, even if the IDs match. Don't count on GA4 to sort it out.
  5. Repeat after any theme change or container publish.

Neither company has written down what Shopify recommends for a storefront-only container, how GA4 treats the same purchase from different sender types, or whether any dedup window exists. As of 2026-11-11 those are unknowns, so the test order is your evidence.

FAQ

Does the March 2027 script tag stop break my GTM snippet?

The stop concerns script tag records, which "will have no effect" after 2027-03-01 [7]. The pages cited here don't apply it to code pasted into your theme.

Does Google support Google Tag Manager in a Shopify custom pixel?

No. Google says it doesn't support running Google tags inside the custom pixel and that its support can't help troubleshoot it [4].

Can I use GTM on checkout without a custom pixel?

Shopify's GTM page sends upgraded checkout use to its custom pixel tutorial [1]. I found no Shopify page that describes another route.

Should I use the Google & YouTube app instead?

Google's page says to move Google tags out of containers on Shopify sites, and that GTM itself can't be set up through that app [4].

Will GA4 dedupe my GTM purchase against another sender's?

Google says GA4 deduplicates purchases with the same transaction ID [8], and says nothing about two different senders. Keep one sender and check the IDs on one test order.

Run the test order, then decide who owns the purchase

Compare the purchase hits and their transaction IDs in DebugView before you leave a container and an app both sending. WeltPixel Conversion Tracking sends each order's purchase from the Shopify order to eleven integrations; the free plan is GA4 only, up to 100 storefront orders a month, and Plus is $39/month [14] with no order limit and also sends admin, POS and draft orders.

Sources

  1. Shopify Help Center, "Google Tag Manager", help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-tag-manager, accessed November 11, 2026
  2. Shopify Help Center, "Create a Google Tag Manager custom pixel", help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/gtm-tutorial, accessed November 11, 2026
  3. Shopify Help Center, "Migrating pixels", help.shopify.com/en/manual/promoting-marketing/pixels/pixel-migration, accessed November 11, 2026
  4. Google Tag Manager Help, custom pixel limitations on Shopify, support.google.com/tagmanager/answer/16000892, accessed November 11, 2026
  5. Shopify developer documentation, "Pixels", shopify.dev/docs/apps/build/marketing/pixels, and Web Pixels API, shopify.dev/docs/api/web-pixels-api, accessed November 11, 2026
  6. Shopify developer documentation, "Emitting data" (custom events), shopify.dev/docs/api/web-pixels-api/emitting-data, accessed November 11, 2026
  7. Shopify developer documentation, "Storefront script tags", shopify.dev/docs/apps/build/online-store/script-tag-deprecation/storefront, accessed November 11, 2026
  8. Google Analytics Help, "Minimize duplicate key events with transaction IDs", support.google.com/analytics/answer/12313109, accessed November 11, 2026
  9. Shopify developer documentation, "DOM events" and "Advanced DOM events", shopify.dev/docs/api/web-pixels-api/dom-events, accessed November 11, 2026
  10. Shopify Help Center, "Custom pixels" and "Manage custom pixels", help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels and help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage, accessed November 11, 2026
  11. Shopify developer documentation, "Script tag deprecation: Order status page", shopify.dev/docs/apps/build/online-store/script-tag-deprecation/order-status, accessed November 11, 2026
  12. Shopify developer documentation, "checkout_completed", shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed, accessed November 11, 2026
  13. Google Tag Manager Help, "Shopify: Set up your Google tag", support.google.com/tagmanager/answer/12183125, accessed November 11, 2026
  14. WeltPixel Conversion Tracking, Shopify App Store listing (free plan: GA4 tracking up to 100 orders/month; Plus $39/month), apps.shopify.com/weltpixel-conversion-tracking, accessed November 11, 2026
  15. Google Tag Manager Help, "Remove duplicate tags after migrating to the Google & YouTube app on Shopify", support.google.com/tagmanager/answer/16424072, accessed November 11, 2026
  16. Google Analytics Help, "Monitor events in DebugView", support.google.com/analytics/answer/7201382, accessed November 11, 2026

Ready to upgrade your tracking?

Server-side tracking for Magento and Shopify: more of your conversions reach GA4 and your ad platforms, with better attribution.