Google Tag Manager(also known as GTM) is one of the most influential and useful tools for marketers, entrepreneurs, developers, and many others. However, Shopify doesn't have a native integration for GTM and it is a little tricky to set it up.
Update (11.12.2022) 🎉 We are excited to announce the release of our updated guide on setting up Google Tag Manager on Shopify. This new version includes the latest updates and improved methods for setting up Google Tag Manager on your Shopify store. To access the guide, please visit the following link: How to set up Google Tag Manager on Shopify.
We hope this guide will help you easily implement Tag Manager on your store and improve your tracking and analysis capabilities.
Update (17.04.2022) We have made an in-depth update on our tutorial series and also included data layers for product - purchase pages, GTM container and more. Check out our latest tutorial: Set up GTM on Shopify [2022 Edition].
Update (23.03.2021) This tutorial explains how to add GTM into Shopify directly. We have made a new - free Shopify - Google Tag Manager video course series on Youtube. Check out the video series if you want to further expand your data-analytics setup.
Why use Google Tag Manager on Shopify
Google Tag Manager allows us to manage all the marketing and tracking tags from one place, deploy and test quickly. Without using the GTM, marketers need developers to set up the tags - and even it isn't very easy for developers to set up certain tags in certain conditions. As a concrete example, you need to add the Google Analytics Global tag to all pages, the purchase event to thank you page, the form submission event to be triggered once the form is submitted correctly. All of them can be done quickly in GTM within minutes. I can count the benefits of GTM for hours, but the topic is now how to add the Google Tag Manager into your Shopify store.
Shopify - Google Tag Manager Integration
Shopify doesn't have a native integration with the GTM. There are two methods to add the Google Tag Manager container (code) into the Shopify stores. We will add the code manually into your Shopify store's theme and checkout files in the first method. In the second method, we will review a few Shopify apps that do the integration for you.
Method 1: Adding GTM into the Shopify Theme
It might not sound effortless, but it is actually quite applicable. We will walk you through the steps, and you will easily be able to add Google Tag Manager to your Shopify store. Follow the steps below, and don't miss the last step. Otherwise, the code won't be triggered on your thank you page, which is very important.
Step 1: Get your GTM Container Code
Register for Google Tag Manager if you are not registered already. You can follow this simple tutorial if you don't have an account yet. Once you are logged in to your account, click your GTM ID at the top of the screen and copy the given code below.
Copy the first code. Don't mind about the second code. That's rarely needed, and it will complicate the setup of your store. Once you make sure to copy the first container code - move to the second code.
Step 2: Insert GTM code into Your Theme Files
As we have your Google Tag Manager Container code in place, it is now time to place it into your Shopify store. You need to be logged in to your Shopify admin to do so.
Shopify Admin > Online Store (Left Menu) > Actions (Near your theme name) > Edit Code
Search "theme.liquid" on the left search bar and find
tag within the file. Paste the GTM container right below the tag.Now the GTM code will be shown on every page in your store except for the checkout processing and thank-you pages.
An important note: If you are using a page builder plugin, you need to paste the code within those liquid files.
Step 3: Insert GTM code into Your Checkout Processing Page
Shopify's basic plans won't allow you to edit the checkout process and add codes there. But you can still add codes on the "order completed" page. This is a crucial step because you want to track purchases in your Shopify store.
Follow the steps below to find the Order Processing section.
Shopify Admin > Settings > Checkout > Order Processing Section
and then paste your GTM container code there.
Now we are set. The GTM will work on your store pages and also on the thank you page. Let us remind you again that it won't work in the checkout steps (where the user enters their credit card and address information) - but it will still work on the order completed page.
Step 4: Validate if the GTM is working
With the data-related works, you always have to double-check and validate. GTM has a great tool called Debugger (also known as Preview & Debug Tool or Google Tag Assistant) to show you if the GTM works on your store and which tags/triggers are working.
- Go back to your Google Tag Manager interface and find PREVIEW from the right-top corner.
- Enter your store's URL and click Start
- It should open your store in a new window. Make sure that your browser is not blocking the pop-up. If yes, firstly allow it. You should see DEBUGGER CONNECTED at the right-bottom of the screen.
- Go back to Tag Assistant, and you should be seeing the "CONNECTED" message here and the TAGS in your GTM account.
Method 2: Using a Shopify App for Google Tag Manager
The second option is using an app to add Google Tag Manager into your Shopify store. There are several apps in the market.
If you only need the GTM container, you do not need to use an app. Method 1 will work great for you. The apps are doing the same steps that we walked you through to make the GTM working on your store. If you are looking for an in-depth tracking setup, then we definitely recommend using an app. Because the apps will also insert dataLayers into your store, allowing you to track more actions such as product impressions, add-to-cart events, search listing actions, checkout process, remove from cart, user ID, and many others.
The app we developed, Analyzify does the following (and even more) for your store:
- Add advanced dataLayers to track all essential actions
- Provides you a complete GTM container that has all the triggers, tags, and many others,
- Sets up Google Analytics 4 with all-important e-commerce features store (Learn more about GA4 for Shopify)
- Provides custom setup support(at no extra cost),
- Creates precious user metrics such as User ID, User Recency, User Type, User Lifetime value, and many others,
- Sets up Facebook Pixel and all related events,
- Sets up Google Ads conversion tracking and all related remarketing events
Analyzify is not the only solution in the Shopify app store. There are other cool apps as well. Make sure to check each of them before you make your decision!
Google Tag Manager without Shopify Plus
We keep receiving this question from Shopify community: "Can I use Google Tag Manager without Shopify Plus plan?" The answer is short: you definitely can - and 1000s of Shopify merchants are already using GTM with regular Shopify plans. There will only be a limitation:
You will not be able to add your GTM container into checkout pages as you don't have the checkout.liquid file. However, your GTM setup will still work on all other pages + order complete pages. That means you can still track 95% of your page visits including the most important e-commerce events.
In other words, if you are running a Shopify Plus store; your GTM script will be running during the visitor's checkout process as well. Without the Shopify Plus plan, it will be interrupted during the checkout steps (where the user enters their credit card, address, etc information) and then be loaded back on the thank you page.
FAQ on Shopify & Google Tag Manager Integration
I wanted to collect here some of the most commonly asked questions on Shopify & GTM topic.
How can I set up enhanced e-commmerce on Shopify using Google Tag Manager?
Shopify merchants are often confused about the enhanced e-commmerce (aka EEC) topic. EEC is actually a feature of Google Universal Analytics and it doesn't mean a full e-commerce tracking. Google Ads or Google Analytics 4 doesn't have enhanced e-commerce tracking; they have their own terms for the same reports. As for the question, you can not do a complete enhanced e-commerce setup without a Shopify Plus plan because you will miss the checkout steps. For a complete e-commerce tracking using Google Tag Manager; we would strongly recommend using: Analyzify: GTM & GA4 App for Shopify.
How to track Shopify checkout steps using GTM?
Well, this is only possible if you are on a Shopify Plus plan as explained in-depth above. You won't be able to add a code to the checkout steps on Shopify without having to access to checkout.liquid file.
How to track Add To Cart event with Google Tag Manager?
It is relatively a complex setup as "Add to Cart" scripts differ from store to store. We recommend using an app to have an accurate solution on this. As Analyzify, we provide a custom development support to make "Add to Cart" tracking work properly on Shopify stores.
Does Shopify have GTM data layers?
Shopify doesn't have the data layers by default. However, there are open-source solutions like Analyzify Shopify data layers that you can use.
What about Shopify Google Tag Manager apps?
The apps will provide you a more in-depth setup, data layers, pre-built Google Tag Manager container, and support. We would strongly recommend using one of the Shopify GTM apps especially if you are spending good amount of marketing dollars. Your reporting and tracking will get better and it should help with your ROI.
Final Words on Usage of GTM on Shopify
We only walked through the installation and setup process in this tutorial. GTM is powerful and beneficial. You should research more and learn better to take advantage of it in the best possible way.
Top comments (4)
We are excited to announce the release of our updated guide on setting up Google Tag Manager on Shopify. This new version includes the latest updates and improved methods for implementing Tag Manager on your Shopify store. To access the guide, please follow the link below:
Updated Guide: Set up Google Tag Manager on Shopify
We hope this guide will help you easily implement Tag Manager on your store and improve your tracking and analysis capabilities. Thank you for choosing our guide and please let us know if you have any questions or feedback.
Do you suggest adding Facebook Pixel and Google Ads Conversion Tracking through Google Tag Manager or using Shopify's default integration?
Shopify's native integration is great; especially for non-technical regular users. It also sends the most important events to Facebook & Google.
However, a well-set GTM structure would help much more. You could send more data and optimize the Ads better that way. You will need to use an app for that though. Analyzify could be an option - others are doing good too. Just check and compare :)
Otherwise, without a professional setup - with a normal GTM integration - you won't get much. So in that case; I recommend using Shopify's native & default integration.
I have made some 2022 updates in the article and shared the latest information!