Laptop on a dark desk showing a website analytics dashboard with green charts, beside a notebook and a cup of coffee

How to Add Google Tag Manager to Shopify: 7 Smart Steps

By the Dropship Stair team. Last reviewed: November 2026.

To add Google Tag Manager to Shopify, create a container at tagmanager.google.com, paste its two snippets into your theme.liquid file, then set up checkout tracking with a custom pixel in Settings, Customer events. Test everything in Preview mode before you publish the container.

Key takeaways

  • Google Tag Manager is a free tool from Google that holds your tracking tags in one container, so you install one snippet on your store and manage every tag from the GTM dashboard instead of editing theme code.
  • Paste the GTM snippets into theme.liquid for storefront pages, and use a custom pixel in Settings, Customer events, for checkout and thank you page tracking.
  • Shopify retired checkout.liquid and is switching off the Additional Scripts box, so tracking that relies on those old spots will stop working.
  • Duplicate your theme before you edit any code, and test in GTM Preview mode, so a bad tag never reaches your live store.

What is Google Tag Manager, and why do Shopify stores use it?

Google Tag Manager is a free tag manager from Google that lets you add and change tracking code on your store without editing theme files each time. You install one container snippet, then every tag, from Google Analytics to ad pixels, is controlled from the GTM dashboard.

Think of it this way: Google Analytics is the report where you read what happened, and Google Tag Manager is the tool that decides which tracking code runs and when. A store without GTM pastes a new snippet into the theme for every platform it advertises on, which is slow and risky when you run Google Ads, Meta ads, and analytics at the same time.

Our guide to Shopify analytics for beginners explains what to read once the data starts flowing.

What do you need before you add Google Tag Manager to Shopify?

Before you start, gather four things so the setup takes minutes instead of an afternoon. First, a Google account that belongs to the business, not a personal account an employee could take with them. Second, admin access to your Shopify store, because you need to edit the theme and open Settings, Customer events. Third, your Google Analytics measurement ID if you plan to send data to GA4, which starts with G- and lives in GA4 under Admin, Data Streams. Fourth, a note of which Shopify plan you are on, because checkout tracking works differently on Plus and on other plans.

You do not need a developer for the storefront part. The checkout part uses a custom pixel with a small amount of JavaScript, but Shopify gives you a guided flow for it.

How to add Google Tag Manager to Shopify in 7 steps?

Follow these seven steps in order. The first four put GTM on your storefront pages, the fifth covers checkout, and the last two add your first tag and prove it works.

Step 1: Create your GTM account and container

Go to tagmanager.google.com and sign in with your business Google account. Click Create Account, enter your business name, and set the country. Then create a container: name it after your store domain, choose Web as the target platform, and accept the terms. Google gives you a container ID in the form GTM-XXXXXXX and two code snippets, so keep this tab open. One container per store is the right setup, so do not create a second one for the same shop.

Step 2: Duplicate your live theme first

In your Shopify admin, go to Online Store, Themes. Find your live theme, click the three dots next to it, and choose Duplicate. Work on the copy, not the live theme, so a paste in the wrong place never breaks the store your customers see. Then click the three dots on the duplicate and choose Edit code.

Step 3: Paste the first snippet right after the opening head tag

In the code editor, open theme.liquid from the Layout folder. Find the opening head tag near the top of the file, paste the first GTM snippet immediately after it, then save. This snippet loads the container on every storefront page, including product, collection, and blog pages. Do not paste it into a section file, because then it would only load on the pages that use that section.

Step 4: Paste the second snippet right after the opening body tag

Still in theme.liquid, find the opening body tag further down the file, paste the second GTM snippet immediately after it, then save. This is the noscript fallback that helps tracking work for visitors whose browsers block scripts. Both snippets must be in place before GTM works properly, and swapping them is a common mistake that makes tags misfire, so check the placement before you save. Preview the duplicated theme to confirm the store still loads and looks right.

Step 5: Set up checkout tracking with a custom pixel

Theme code never loads on checkout, so purchases need a different route. In your Shopify admin, go to Settings, Customer events, and click Add custom pixel. Name it GTM Checkout. Shopify offers a guided Install Google Tag Manager flow here: enter your container ID and Shopify builds the snippet for you. The pixel listens for events such as checkout_completed and pushes the order value into the data layer for GTM to read. Save it and connect it. This replaces the old Additional Scripts box, which Shopify made read-only in August 2025 and is removing for remaining non-Plus stores in August 2026.

Step 6: Add your first tag, the GA4 configuration tag

Back in GTM, open Tags and click New. Name it GA4 Configuration, All Pages. Click Tag Configuration, choose Google Analytics: GA4 Configuration, and paste your measurement ID, the one that starts with G-. Under Triggering, choose Initialization, All Pages, so the tag fires on every page load, then save. One warning matters: if GA4 is already connected through the Google and YouTube app, you now have two GA4 connections and your reports will double count, so pick one route and disconnect the other.

Step 7: Test in Preview mode, then publish the container

In GTM, click Preview and enter your store URL. Tag Assistant opens your store in a new tab, and you can click through product pages, add a product to the cart, and watch which tags fire. Fix anything that fires twice or not at all, then go back to GTM, click Submit, name the version, and click Publish. Nothing you set up goes live until you publish, so Preview alone is not a finished install. After publishing, open GA4 Realtime and confirm your own visit shows up.

Which way to install Google Tag Manager fits your store?

There is no single best method, because each one trades control for convenience. Pick the row that matches your comfort with code and the platforms you advertise on.

Method Best for Checkout tracking Effort
Manual theme edit Stores that want full control over every tag Needs a custom pixel Medium
Google and YouTube app Stores that only need Google tracking Automatic Low
GTM app from the App Store Stores that want setup without code Depends on the app Low
Custom pixel only Checkout and thank you page events Built for it Medium

If your question is how to add Google Tag Manager to Shopify so it covers every platform, not just Google, use the manual theme edit plus a custom pixel, because that pair keeps full control of the data. The Google and YouTube app is the simpler pick if you only advertise on Google, but it cannot carry a Meta Pixel or a TikTok Pixel. First Pier’s 2026 GTM guide walks through the same methods with screenshots.

What mistakes break Google Tag Manager on Shopify?

The most common mistake is double counting. Stores run GA4 through the Google and YouTube app and through GTM at the same time, so every purchase shows up twice and ad platforms optimize on inflated numbers, so pick one route for each platform and turn the other off. The second mistake is pasting snippets into the wrong file, often a section file instead of theme.liquid, which leaves half the store untracked. The third is trusting the Additional Scripts box for purchase tracking, which is already read-only and is being removed. The fourth is forgetting to publish the container after testing, so Preview mode looks fine while the live store sends nothing. The fifth is skipping the theme duplicate, which turns a small paste error into a broken storefront.

How do you check that Google Tag Manager is working?

Start with GTM Preview mode, which shows every tag that fires as you browse the store. Then open GA4 DebugView and watch your own page views arrive in real time. Place a test order with a 100 percent discount code and confirm the purchase event carries the right value and order ID. If an event is missing, the cause is usually a trigger set to the wrong page, a container that was never published, or a duplicate tag from another integration. Fix one cause at a time and retest.

Frequently asked questions

Do I need Google Tag Manager if I already have Google Analytics on Shopify?

You do not need it for basic analytics, because Shopify can connect GA4 through the Google and YouTube app. You need GTM when you run several platforms at once, since it holds every tag in one place and saves theme edits for each new pixel.

Can I add Google Tag Manager to Shopify without a Plus plan?

Yes, you can add Google Tag Manager to Shopify on any plan. The theme.liquid install works the same on Basic, Grow, and Advanced. Checkout tracking also works on every plan now, because Shopify lets all stores use Customer events and custom pixels instead of the old checkout.liquid file.

Where do I paste the Google Tag Manager code in Shopify?

Paste the first snippet in theme.liquid right after the opening head tag, and paste the second snippet right after the opening body tag. Both snippets belong in theme.liquid only, not in a section or snippet file. Checkout tracking is separate and uses a custom pixel in Settings, Customer events.

Why is my purchase event missing after I install Google Tag Manager?

The usual cause is that the purchase happens on checkout, which theme.liquid never loads. You need a custom pixel in Settings, Customer events, that listens for checkout_completed and sends the order to GTM. Also check that the container is published, since Preview mode alone sends nothing live.

Is Google Tag Manager free to use on Shopify?

Yes, Google Tag Manager is free, and there is no Shopify fee for installing it. Some third-party GTM apps charge a monthly fee for prebuilt containers and data layers, but the manual install and the custom pixel method in this guide cost nothing beyond your time.

Learning how to add Google Tag Manager to Shopify turns tracking from a pile of pasted snippets into one container you control. Install it on theme.liquid, cover checkout with a custom pixel, add your GA4 tag, and test before you publish, and your ad platforms will finally optimize on real numbers. If you would rather have the setup handled for you, see the Dropship Stair Shopify store services, and for the reporting side, read our Shopify SEO checklist.

Sources: First Pier, Google Tag Manager on Shopify setup and tracking, checked November 2026; Stape, how to add Google Tag Manager to Shopify, checked November 2026; the Dropship Stair guides linked in this article.

Last reviewed: November 2026.

Share the post

Scroll to Top