Chapter 1
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.
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.
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.
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.
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
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.
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.
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!
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. ⬇️
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:
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.
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.
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:
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.
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.
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.
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.
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.,
Follow this video tutorial and create the GA4 global tag on your GTM container.
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!
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.
You are on this content series:
Check out our complete guides: