All How-To Guides
Shopify10 min·6 steps

How to Install Google Tag Manager on Shopify (2026 Step-by-Step Guide)

Shopify doesn't have a native GTM integration the way it does for Google Analytics, so installation involves pasting both the <script> and <noscript> snippets into your theme. The whole process takes about 10 minutes for a standard install. Shopify Plus stores can use checkout extensibility for cleaner checkout-page tracking; non-Plus stores have a few more constraints around the checkout flow.

What you'll need before you start

  • A Shopify store on any plan (Plus is required for full checkout-page GTM)
  • Owner or staff with permission to edit themes
  • A Google account

How to install Google Tag Manager on Shopify: Step-by-step

  1. 1

    Create a GTM container at tagmanager.google.com

    Go to tagmanager.google.com and sign in. Click Create Account, set country, container name (your store URL), and target platform Web. Accept the Terms. GTM gives you two snippets - a <script> for <head> and a <noscript> for after <body>. Both contain your GTM-XXXXXXX container ID.

  2. 2

    Edit theme.liquid

    In Shopify, go to Online StoreThemes → click ... on your active theme → Edit code. Open layout/theme.liquid. Paste the GTM <script> block immediately after the opening <head> tag. Then paste the <noscript> block immediately after the opening <body> tag. Click Save.

  3. 3

    Add GTM to the order status page

    The standard theme.liquid doesn't render on the order confirmation page (Shopify hosts that separately). Go to SettingsCheckout. Scroll to Order status pageAdditional scripts. Paste the same GTM <script> block here. Save. This is what fires your purchase tag.

  4. 4

    Push ecommerce events into the data layer

    Shopify doesn't push ecommerce events into dataLayer automatically. To make GTM aware of products viewed, added to cart, and purchased, paste a custom data-layer snippet into theme.liquid. The snippet uses Shopify's Liquid templating to read product/cart/checkout data and push standard GA4-format events. There are well-maintained open-source templates - search for Shopify GTM data layer on GitHub - and Elevar / Analyzify also offer paid Shopify apps that handle this for you.

  5. 5

    Add your first tag (e.g., GA4) and publish

    In tagmanager.google.com, click TagsNewGoogle Analytics: GA4 Configuration. Paste your GA4 Measurement ID, set trigger to All Pages, save. Click Submit in the top-right to publish the container.

  6. 6

    Verify with GTM Preview

    In GTM, click Preview (top-right). Paste your store URL and click Connect. A new browser window opens showing your store with the GTM debug panel. Browse a product, add to cart, run a test order. Each interaction should trigger the appropriate tag in the Tags Fired list.

How to verify your setup is working

GTM Preview mode is the most thorough check - it shows every tag, trigger, and data-layer event firing in real time. The free Google Tag Assistant Chrome extension is faster for spot-checking specific pages. If you've connected GA4 inside the container, Realtime in GA4 should also show your test traffic.

Common issues and fixes

Tags fire on the storefront but not on the order confirmation page

You forgot step 3 - the order confirmation page is a separate Shopify-hosted page that doesn't render theme.liquid. Add the GTM <script> block to SettingsCheckoutOrder status pageAdditional scripts. Save and run a test order to confirm.

GTM is firing but ecommerce events aren't appearing in GA4

Two layered causes. (1) The dataLayer.push for ecommerce events isn't set up - Shopify doesn't do this automatically. You need a custom data-layer snippet in theme.liquid or a paid Shopify app like Elevar / Analyzify. (2) Your GA4 tag in GTM is configured for "All Pages" but doesn't map ecommerce events. Create dedicated GA4 Event tags for view_item, add_to_cart, purchase, etc., with triggers matching the corresponding data-layer events.

Shopify Plus and checkout extensibility - where does GTM go?

For Plus stores using checkout extensibility (the new app-block-based checkout), the legacy Additional scripts field is being phased out. Use the Customer Events system: SettingsCustomer eventsAdd custom pixel. Paste GTM as a custom pixel; events fire on the entire checkout including the thank-you page. This is the only path going forward for Plus stores.

Frequently asked questions

Does Shopify support Google Tag Manager?

Yes - Shopify supports GTM via theme editing (storefront) and additional scripts (order status page). There's no native GTM integration the way there is for GA4 through the Google & YouTube channel, but the manual install is straightforward and well-documented.

Should I use the Google & YouTube channel or Google Tag Manager on Shopify?

Use the Google & YouTube channel if GA4 is your only tag - it auto-wires ecommerce events with zero configuration. Switch to GTM the moment you add a second tag (Meta Pixel, TikTok Pixel, LinkedIn Insight, conversion APIs). Don't run both for GA4 - that double-tracks every event. Either disable GA4 in the Google & YouTube channel or don't add it to GTM.

Can I add Google Tag Manager to Shopify without editing the theme?

For storefront tracking, no - you have to edit theme.liquid. There's no first-party Shopify app that can install GTM at the theme level. For Shopify Plus stores, the new Customer Events / custom pixels system avoids theme editing entirely, but it's only available on Plus.

How do I track Shopify ecommerce events with GTM?

Three options. (1) Hand-write a Liquid-based data-layer snippet in theme.liquid that pushes view_item, add_to_cart, etc., into dataLayer. (2) Use a paid Shopify app like Elevar, Analyzify, or Tracking Pro that handles the data layer for you. (3) On Shopify Plus, use the new Customer Events system, which exposes ecommerce events to GTM via custom pixels.

Will Google Tag Manager work with Shopify's headless storefronts (Hydrogen)?

Yes, but you have to install GTM yourself in your frontend framework (Next.js, Hydrogen, custom React app). The traditional theme.liquid path doesn't apply. Use Shopify's Storefront API plus a customer events webhook for purchase confirmation server-side.

How do I know Google Tag Manager is working on my Shopify store?

Use GTM's Preview mode - it shows every tag fired and every trigger matched as you browse your store. The free Google Tag Assistant Chrome extension is also good for spot-checking. If you have GA4 inside the container, Realtime in GA4 should show your test session within 30-60 seconds.

Once you're set up, MeasureBoard turns the data into action

MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.

Get Started Free