How to Add Google Tag Manager to Shopify Store (Updated 2026)

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Introduction

Adding Google Tag Manager (GTM) to Shopify helps you track user behavior, measure conversions, and integrate analytics tools like Google Analytics 4, Meta Pixel, remarketing tags, and more, all without constantly editing your theme code. GTM acts as a centralized hub where you manage all your tracking tags inside one container. In this guide, you’ll learn the recommended method how to add Google Tag Manager to Shopify store by editing Shopify theme code and an easier alternative using Shopify apps. Whether you’re tracking purchase events, marketing campaigns, or custom events, GTM makes your data more accurate and marketing smarter.

If you are making theme edits, you may also want to explore customizations like adding custom code to header.

What Is Google Tag Manager?

Google Tag Manager (GTM) is a free system for managing marketing and analytics tags on a website without requiring direct changes to the site's code. It enables users to deploy, manage, and update tracking codes for services like Google Analytics or Ads through a web-based interface.


Benefits of Using Google Tag Manager in Shopify

Google Tag Manager (GTM) provides various benefits, such as:

  • Keep all your tags organized in a single location.
  • You can update tags and launch them much more quickly, without waiting for a developer to make code changes for each update.
  • Marketing teams can manage their own tags, making them less reliant on developers for minor updates.
  • Allows you to track changes and revert to previous versions of your tag setup if an issue arises.
  • Integrates with a wide variety of Google and third-party tags.


Methods for Adding Google Tag Manager to Shopify

There are various methods for adding Google Tag Manager to your Shopify store. Some of these are given below.

  1. Editing the theme code (recommended)
  2. Install an App from the Shopify App Store


Method 1: Editing the theme code (recommended)

Before editing theme code, always ensure you can rollback or have Shopify website maintenance support set up.

Follow these steps to add Google Tag Manager using the theme code.

Step 1: Visit Google Tag Manager.

Step 2: Log in to your account or create one if you are not already registered.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 3: Add the account name and select the country where your business is located.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 4: Add the container name, typically your store URL, and select Web as the type.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 5: Click the Create button and accept the terms.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 6: Copy the code snippets and paste them in the specified location.

Step 7: Navigate to Online Store > Themes > Edit Code.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 8: Go to the theme.liquid file

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 9:  Add the first code snippet inside the <head> tag as high as possible.

  
    <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-NPQKJ5H3');</script>
    <!-- End Google Tag Manager -->
  

Step 10: Add the second code snippet immediately after the opening <body> tag.

  
    <!-- Google Tag Manager -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NPQKJ5H3"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager -->
  

Step 11: Save the changes.


Step 12: To verify GTM installation, open your website in a new tab.

Step 13: Right-click > View Page Source or Press CTRL + U for Windows.

Step 14: Press CTRL + F for Windows or Cmd + F for Mac and search for GTM.

Step 15: If the installation is successful, then you’ll see the GTM container in your code.

Step 16: Navigate to tags and click the New button to add tags.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 17: Click on this box to select the type of tags you want to add.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 18: Select the type of tag you want to add.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 18: Configure different settings according to the needs.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 19:  Ensure Tag ID is not empty, and save the changes.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 20: Click the Submit Button.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 21: Publish the changes.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

 

Method 2: Install an App from the Shopify App Store

If you are not comfortable with coding and looking for a no-code solution,  you can install an app from the Shopify App Store and add Google Tag Manager to your store. Follow these steps for a step-by-step guide.

Step 1: Navigate to Shopify Admin > Apps.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 2: Click the App and Sales Channels Settings button.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 3: Visit the Shopify App Store.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 4: Search for an app such as Google Tag Manager GA4

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 5: Install the app.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 6: Reconfirm the installation process.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 7: Add the GTM container ID and add the Google Analytics Measurement ID

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 8: Navigate to Online Store > Themes > Customize

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 9: Enable the app embed and save the changes.

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Step 10: Set up your custom pixel and ensure it's connected. 

How to Add Google Tag Manager to Shopify (Step-by-Step Guide 2025)

Final Thought About How to Add Google Tag Manager to Shopify Store

Installing Google Tag Manager on Shopify is one of the smartest steps you can take for better analytics, retargeting, and marketing automation. If you’re searching for how to add Google Tag Manager to Shopify, a proper GTM setup lets you deploy tags faster, improve campaign tracking, understand your customers better, and boost your store’s performance.

By keeping your marketing tools connected and data organized, GTM helps you scale your Shopify business confidently and efficiently.

If you prefer expert setup, our Shopify SEO consultants or custom theme developers can implement advanced GTM tracking for you.

 

Frequently Asked Questions

You can add Google Tag Manager to Shopify by creating a GTM container, copying the code snippets, and pasting them inside your theme.liquid file within the <head> and <body> tags. You can also install a GTM app from the Shopify App Store if you prefer a no-code setup.

Place the first GTM script as high as possible inside the <head> tag, and the noscript version immediately after the opening <body> tag. This ensures accurate tag firing and proper tracking.


Open your store in a new tab → Right-click → View Page Source → search for “GTM-”.

You can also enable Preview Mode in Tag Manager or use Google Tag Assistant Chrome extension to confirm tags are firing correctly.

Yes! GTM is the recommended way to deploy Google Analytics 4 (GA4) in Shopify. You can manage GA4 tags, conversion tracking, remarketing, and custom events directly from GTM.

Shopify does not require GTM, but using it provides better flexibility and makes it easier to manage multiple tracking tools such as Google Ads, Meta Pixel, TikTok Pixel, and more — all from one dashboard.

Common issues include incorrect code placement, theme caching, missing permission in app embeds, or publishing errors in GTM. Try clearing cache and verifying that your tags are Submitted + Published in GTM.

Comments(0)
You don't have any comments yet

Leave a comment
Are You Looking for a Shopify Expert?

We design, develop, optimize, and scale high-converting Shopify stores.

Get in touch
Let's Connect
Shopify Plus eCommerce Development Agency ecomx agency

Looking for a Trusted Ecommerce & Shopify Plus Agency?

We design, develop, optimize, and scale high converting Shopify Ecommerce stores that drive sales.

Get in Touch
Ecomx shopify plus agency about us page Yasin

Looking for a Shopify expert to handle a small task? Shopify Migration Experts Agency Ecomx shopify plus agency

Let’s talk about your project

Shopify Custom Theme Development Services Live Chat