This is your step-by-step, detailed guide for setting up Google Tag Manager on your Shopify store – prepared by true experts who love to share!

Google Tag Manager (GTM) works great on Shopify – including non-Shopify plans. Setting up Google Tag Manager on Shopify isn’t a quick process, but there are several methods available. We will guide you through these methods with step-by-step tutorials.

You can do the setup yourself by following the tutorial provided below. Alternatively, you can use a Shopify Google Tag Manager app which will handle most of the process for you. Both options are perfectly fine, depending on your needs. ⬇️

Effortlessly integrate Shopify & GTM, including advanced data layers.
Start Setting Up!
Chapter 1

Setup Method 1 : Manually Install GTM on Shopify

In this method, we will guide you step-by-step on how to manually install Google Tag Manager (GTM) containers in your Shopify store. We will also carry out debugging at the end of the section to ensure the GTM container is correctly placed.

We have made a dedicated YouTube tutorial video that you can watch at the end of this section. Click here if you want to do the GTM set up on Shopify using our video tutorial.

How to Install Google Tag Manager without Shopify Plus [no-app]

Let’s begin setting up GTM on your Shopify store. Don’t forget to check the bottom section of the article where we will use the data layers, GTM tags and triggers to enhance and complete your setup. That will allow you to set up conversion tracking through Google Tag Manager as well.

Let’s get your GTM container code.If you don’t have an account yet, you can follow  this tutorial to create a GTM account , and then come back here. Go to your Google Tag Manager account. Click on your GTM ID on the top-right corner of the screen (labeled as #1 in the screenshot). Copy the first part of the code.

Edit theme files in Shopify

Go to your Shopify Store Admin > Online Store > Themes. Click on the three dots near your current (live) theme.
As we will have to edit your theme files, it is a good idea to start by duplicating your theme so you have a backup. Duplicate your current theme so that you have a backup option to revert back to in case something goes wrong.
After duplicating, click the three dots > Edit Code.

Add GTM code into Shopify theme

After clicking edit code, paste the GTM code you copied earlier under in the theme.liquid layout.

Note: If you are using a Page Builder App that has created new liquid files in your theme; you will need to paste the GTM container code in those pages separately. Otherwise, GTM will not be visible on those pages. Make sure to visit all of your pages and see if the GTM container is placed correctly. We will conduct a debug at the end of the tutorial.

Unfortunately, Shopify doesn’t allow us to add code to the Checkout page unless you have the Shopify Plus plan. So, the GTM will not work on your checkout and cart pages. That being said, it is not that big a deal. What matters most is the “purchase completed” and we will now add the code there.

Go to Shopify Admin > Settings > Checkout

Paste the GTM code into Additional Checkout Scripts

Keep scrolling within Checkout, and find the section called Order status page. Just paste the same GTM container code here and save it. If you have any other codes in this section, you don’t need to modify them; just add the GTM container code at the top. This will allow the GTM container to work on the thank-you page. In this way, you can track sales and conversions.

If you are on a Shopify Plus plan, you don’t need to do this. Just add the GTM snippet into the checkout.liquid file.

Test Shopify-GTM Setup using Preview mode

Now it’s time to verify your GTM - Shopify setup. You can use GTM preview mode to check if your GTM tag is installed correctly in your store or not. Go back to your Google Tag Manager account and click Preview. If your GTM container is empty, it will ask you to publish the preview because you just created this account. Publish, approve and move on.

Finalize validation

Type in your store’s URL and click on Connect. If you receive the “Connected” pop-up notification or see “Debugger Connected” in the bottom-right corner, it means that you have successfully installed Google Tag Manager.

Congratulations! Your GTM setup is complete!

Finalize validation

After connecting Tag Assistant, make sure that you visit a few different pages, and hard refresh them if you are not seeing any changes right away. You can also run a test order to make sure that our GTM container is also triggered on the Purchase Completed page.

Remember the GTM Debugger will not be working in checkout steps but it should come back on the thank-you page.

You have now completed setting up Google Tag Manager on your Shopify store. However, adding only the GTM container won’t do anything by itself. You will also need to add tags, triggers, variables through Google Tag Manager.

You will find more details on how you can use GTM on Shopify in our related section. ⬇️

Chapter 2

Setup Method 2: Using a Shopify GTM App

Data has immense importance for e-commerce stores and that’s why every click, user action, and engagement matter. You want to make sure that you can track all the most important events with correct data and share that with third parties such as Google Analytics, Ads, Facebook Pixel, and many others.

You can consider using a Shopify GTM app to integrate your Shopify store with Google Tag Manager. The GTM apps in the Shopify app store can help you with:

    • Installing GTM on Shopify store (like what we have done above),
    • Injecting data layers on your store so that you can pass all relevant data using GTM to other parties,
    • Providing a convenient GTM container file that comes preloaded with tags, triggers, and variables. This means you don’t have to go through the hassle of adding them.
    • Connecting your store with Google Ads, Analytics, Facebook Pixel and many others,
    • Give you guidance and support along the way.

 

Analyzify

Analyzify – the Shopify Google Tag Manager app doesn’t only make GTM work on your store; but also adds complex, advanced dataLayers to your Shopify store that allow you to collect more data and pass it using Google Tag Manager.

Every Shopify store is unique, with its own set of apps and themes. Since most stores customize their themes in different ways, the standard implementation may not work as expected. That’s why it’s important to receive support from the app team to ensure accuracy and seamless tracking.

That’s where Analyzify comes in. We have an outstanding team of data and development experts who have created a versatile solution for Shopify Data Analytics. Moreover, we provide exceptional support and free custom setup to enhance your experience.

Why is Setting Up GTM on Shopify Important?

Installing GTM to Shopify stores doesn’t do much by itself. You should rely on tags, variables, custom events, and a wide range of GTM features to make the most out of it. Google Tag Manager is an incredibly powerful tool, especially for Shopify stores where every bit of data is essential. 

Here is a quick look at why GTM is so important for Shopify businesses.

  • Above all else, GTM allows you to access, organize, and process all of your data in the most efficient way possible. 
  • Instead of trying to send the data to different sources (such as Analytics, Ads, and Facebook Pixel), GTM stores the data within dataLayers, allowing you to process and share it with any tool you want, all within minutes.

With Google Tag Manager, you have a wide range of possibilities at your fingertips. Here are some examples of how you can benefit from GTM for Shopify:

  • You can set up Google Analytics 4, complete with e-commerce tracking capabilities, which will provide valuable insights into your online business.
  • By driving Google Ads conversions, both micro and macro, you can enhance your advertising campaigns and improve their effectiveness. This means better targeting and more efficient spending on ads.
  • With dynamic remarketing for Google Ads, you can personalize your ads and reach your audience with tailored messages. This can increase engagement and conversion rates.
  • You can use Bing Tag for conversion tracking on your Shopify store, allowing you to measure and analyze your campaigns across different platforms.
  • GTM enables you to track custom events that matter to your business. Whether it’s specific user interactions, form submissions, or other important actions, you can collect data about users’ behavior.

These are just a few examples of how setting up GTM on Shopify can bring valuable benefits to your online business. The possibilities are extensive, and you can explore even more features and functionalities based on your specific needs and goals.

Chapter 3

GTM Tags and Triggers For Shopify

Shopify merchants can enhance their data analytics setup using tags, triggers, and variables by installing Google Tag Manager on Shopify.

To achieve more features and gain the benefits mentioned in Chapter 2, it’s essential to set up a data layer on your store and then create the necessary tags, triggers, and variables within Google Tag Manager.

 

How to Set Up GA4 Ecommerce Tracking with GTM

To help you grasp the process, we’ve prepared an example roadmap below. It provides step-by-step guidance on how to set up Google Analytics 4 e-commerce tracking using Google Tag Manager specifically tailored for your Shopify store. 

By following this example, you’ll gain a better understanding of how it all works and you will have a working example.




Step 1: Install Shopify data layer

We have created a publicly available, open-source data layer that's specifically tailored to enhance your tracking capabilities. To take advantage of this valuable resource, you can visit our  Shopify data layer  page and install it on your store.



Step 2: Create variables on GTM


You will also find instructions on how to create variables on Google Tag Manager. Create the purchase-related variables such as order ID, revenue, payment type, and others. You will need to use these variables on your tags.,

Install Google Analytics 4 on Shopify (with GTM) - GTM Essentials


Follow this video tutorial and create the GA4 global tag on your GTM container.

Set up Google Analytics 4 Ecommerce Tracking on Shopify with GTM

Follow this video tutorial and create GA4 e-commerce tracking events.

Note: In the video, there are fewer variables that we provided in step 1. Feel free to add the related variables if you feel comfortable playing around.


You can also set up Google Ads conversions using GTM. Follow this video tutorial to achieve this.

We will keep adding more tutorials and step-by-step guides to help the Shopify community!

Chapter 4

FAQ on Google Tag Manager Setup

You can view your store’s source and search for a line starting with “GTM-“. The container’s code snippet should be visible if you have GTM already installed in your store.

If you do have it installed, just mark the related section during your onboarding, and Analyzify will take care of the rest. If you don’t have it installed, worry not, as Analyzify will do it for you.

Shopify stores use different coding methods and apps to set the add-to-cart function, and unfortunately, there is no easy way to add this event on GTM.

So, we would highly recommend using an app like Analyzify to achieve this.

You can set up GTM on Shopify’s checkout pages using the “checkout.liquid” file in order to track checkout steps. However, this is only possible and available for Shopify Plus merchants at the moment.

Firstly, Enhanced Ecommerce (EE) is a Universal Analytics feature, and you do not need to use Google Tag Manager to set up Enhanced E-commerce on Shopify. Because of the “checkout.liquid” file limitations, setting EE through GTM is only possible for Shopify Plus clients. If you are one and still wish to set it up, you can use Analyzify to achieve this.

Definitely yes. GTM is usable for non-Shopify Plus stores as well. You can add the GTM container to the theme.liquid file and order processing additional scripts.

The only limitation that regular Shopify stores have is NOT being allowed to edit the checkout process due to checkout.liquid file limitations. 

Purchase tracking and other user behavior metrics/reports are so crucial and you will still have a majority of the events/reports.

Google Tag Manager and all other tracking codes will still WORK on every page + order processed (thank you page) but the checkout steps won’t be included.

In some cases, this is expected because you enable the preview and debug mode. Another reason might be installing GTM multiple times. If you manage multiple tags for different pages or products, it may cause double firing. So, you should be careful about configuring multiple triggers. 

You can check out the documentation on GA4 health check for double pixel issues.