How to Add Google Tag Manager to Shopify Store (Updated 2026)
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.
- Editing the theme code (recommended)
- 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.

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

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

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

Step 6: Copy the code snippets and paste them in the specified location.
Step 7: Navigate to Online Store > Themes > Edit Code.

Step 8: Go to the theme.liquid file

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.

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

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

Step 18: Configure different settings according to the needs.

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

Step 20: Click the Submit Button.

Step 21: Publish the changes.

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.

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

Step 3: Visit the Shopify App Store.

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

Step 5: Install the app.

Step 6: Reconfirm the installation process.

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

Step 8: Navigate to Online Store > Themes > Customize

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

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

Some popular apps are listed below:
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.