How To Set Up Google Tag Manager In Shopify?

How To Set Up Google Tag Manager In Shopify?

Integrate Google Tag Manager with Shopify for simplified tracking and analytics, enhancing your e-commerce performance

By: Ayesha Khan | 5 mins read
Published: Oct 30, 2023 1:58:57 AM | Updated: Jun 12, 2024 01:50:01 AM

What is Google Tag Manager?

Google Tag Manager (GTM) is a free tool which is provided by Google that simplifies the process of adding, updating, and managing various tracking codes and scripts on a website.

It is a tag management system that allows website owners, marketers and developers to deploy and control tags (small pieces of code) on their websites without the need for manual coding or constant intervention from web developers.

Get in touch to avail yourself of our Google Tag Manager Consultancy services.

What is Shopify?

Shopify is an e-commerce platform that allows businesses and individuals to create and manage their online stores.

It provides a comprehensive set of tools and features for setting up, customizing, and running an online retail business. Shopify is known for its user-friendly interface and scalability making it suitable for small startups as well as large, established e-commerce operations. 

Why is Google Tag Manager Important for Shopify?

Google Tag Manager is important for Shopify store owners 

  • Simplifies management

 GTM centralizes all your tracking codes in one place, making it easy to add, edit or remove tags without requiring constant access to your website’s code.

  • Reduces dependency on Developers 

You don't need to be a coding expert. GTM gives marketers and store owners the power to manage tracking codes independently, saving time and money.

  • Enhances Site speed

Using Google Tag Manager can improve the site's speed. It is a tag management solution that is flexible enough to store all your analytics and marketing tags. You have the control to fire tags when needed. It can also speed up the site by calling all external files in one go. 

  • Version control

GTM keeps track of tag changes and allows you to roll back to previous versions if any issues arise, ensuring data accuracy.

How to Set Up Google Tag Manager in Shopify?

There are three options to Set Up Google Tag Manager in Shopify.

Setting Up Google Tag Manager Via Theme Files in Shopify

This option involves manually adding the GTM container code to your Shopify theme's code in the theme files. This is the most used option

Here’s a step-by-step guide to how to set up Google Tag Manager via theme files in Shopify

  1. Sign up for Google Tag manager

If you don't already have a Google Tag Manager account, go to and sign up for one, using your Google Account.

Sign up for GTM


         2. Create a new container

Once you are logged into Google Tag Manager, click on “Create Account” and provide the necessary information. Then, click ‘create” to create a new container.


Container in GTM

        3 . Configure your Container

After creating your container, you’ll be prompted to choose where you want to use it. Select “Web” as your target platform since we’re setting up Google Tag Manager for your Shopify store.

        4. Get your GTM code

You’ll receive two code snippets during this step. One is the GTM container code that should be placed in the <head> of every page on your Shopify store. The other is the no script code to be placed immediately after the opening <body> tag.


          5. Add GTM to Your Shopify Store

Log in to your Shopify admin and go to “Online Store” > “Themes.” Select your active theme, click “Actions,” and then choose “Edit code.” find the theme.liquid file and paste the GTM container code immediately after the opening <head> tag. Next, find the NoScript code and paste it immediately after the opening <body> tag

Adding GTM to Shopify.Setting up GTM in Shopify


         6. Verify your setup

After saving your changes in Shopify, return to Google Tag Manager and click “Submit” to publish your container. It’s essential to verify your setup by installing the Google Tag Assistant browser extension or using Google Analytics Real-time reports.

         7. Adding tags in Google Tag Manager

Now that your Shopify store is integrated with Google Tag Manager, you can start adding tags. Common tags to add include Google Analytics 4, Facebook Pixel, and other marketing or tracking scripts.


 Testing and Debugging

Use the GTM preview mode to ensure that your tags are firing correctly. Debug and refine your setup as needed

Setting Up Google Tag Manager via Shopify GA settings

1. Access your Shopify Admin Dashboard

Log into your Shopify admin dashboard using your credentials.

2. Access Online Store Settings

Click on settings from the left-hand navigation, and a submenu will appear. Select “Online Store” from this submenu.

3. Configure Google Analytics Settings

Scroll down to the “Google Analytics” section. If you haven’t set up Google Analytics 4 for your Shopify store yet, you can either enter your GA4 tracking ID or click the “Connect” button to link your Google Analytics account to your Shopify store. You will need a Google Analytics account to proceed.


Set up Enhanced Ecommerce tracking (Optional)

If you wish to use Enhanced E-commerce tracking (recommended for e-commerce businesses), make sure to enable it in your Google Analytics settings.


4. Create a GTM Tag

Now, in your Google Tag Manager account, create a new tag that you want to fire on all pages of your Shopify store. Typically this tag will be for the GTM container itself. Make sure the tag is set to trigger when the page loads.

5. Obtain GTM container Code

Within your Google Tag Manager account, locate your GTM container code. It’s usually found in the container’s “Install Google Tag Manager “ section. Copy the code snippet.

6. Add Google Tag Manager container code to Shopify Theme Settings

Return to your Shopify admin dashboard.

In the “Google Analytics” section (where you added your Google Analytics tracking ID), scroll down further until you find the “Additional Google Analytics JavaScript” text field

Paste the GTM container code into this field. Make sure you place it immediately before the closing <head> tag.

Setting Up Google Tag Manager via GTM suite App

1. Access your Shopify Admin Dashboard

Log in to your Shopify admin dashboard using your credentials.

2. Visit the Shopify App Store

In the left-hand navigation menu, click on “Apps” then click the "visit Shopify App Store” button to access the Shopify App Store.

3. Search for the GTM suite App

In the Shopify App Store: search bar type “GTM suite” or the name of a similar app to find a suitable GTM integration APP. GTM Suite is just one example; you can choose other GTM apps based on your preferences and needs. Install the App.

4. Configure the GTM app

The GTM integration app will guide you through the setup process. You will need to configure it by providing the necessary information:

  • GTM Container ID: You will need your GTM Container ID, which can be found in your Google Tag Manager account.
  • Tracking and Event Configuration: Configure the tracking and events you want to set up with GTM, such as pageview tracking, enhanced e-commerce tracking, and custom events.
  • Other Preferences: Customize settings according to your specific requirements, such as enabling or disabling certain tracking features.

5. Install GTM Code

The GTM integration app will provide you with a code snippet. This code is typically placed in your Shopify theme to load the GTM container. The app will guide you on where to add this code to your Shopify theme.

6.  Verify the Setup

After adding the code to your theme, you can verify the GTM setup. The GTM integration app may provide a testing or verification feature to ensure that the GTM container is functioning correctly.

No matter which option you choose, integrating GTM with Shopify enhances your ability to gather and analyze valuable data, helping you make informed decisions and optimize your e-commerce business. It provides benefits such as centralized tag management, version control, reduced dependency on developers, and improved data consistency


As the e-commerce landscape continues to evolve, harnessing the power of Google Tag Manager in your Shopify store will enable you to stay ahead of the competition and drive success. Whether you're a small startup or a well-established brand, implementing GTM is a step toward making data-driven decisions and improving your online store's performance. So, seize the opportunity to enhance your tracking capabilities and propel your e-commerce business to new heights with Google Tag Manager on Shopify.

Like what you read? Learn more about Digital Analytics on our blog here.