How to Set up Google Tag Manager on Shopify

Setting up Google Tag Manager in Shopify isn’t a quick process but there are a number of ways to set it up. We will walk you through the options. You can either make the setup yourself by following the following tutorial or use a Shopify Google Tag Manager app.

Method 1: Manually Install GTM on Shopify

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

We have made a dedicated YouTube tutorial video that you can watch below. Alternatively, you can follow the steps included in this article.

Step 1: Get your Google Tag Manager (GTM) Container Code

The first step is to place the GTM container in your Shopify store including checkout and thank you pages. If you don’t have a GTM account yet, you can watch this video tutorial to create an account, and then come back here.

Let’s get your GTM container code.

  • Go to your Google Tag Manager account
  • Click on your GTM ID on the top-right corner of the screen (labeled as #1 in screenshot)
  • Copy the first part of the code
  • Screenshot Get your Google Tag Manager (GTM) Container Code

Step 2: Place the GTM Container in your Shopify Theme

GTM container code should be placed in every page of your Shopify store. At first, we will add it to your theme files and then to checkout and thank you pages. To do this,

  • Go to your Shopify Store Admin
  • Then go to the left tab and click Online Store
  • Here you will find Themes

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 if something goes wrong, you will have the option to revert back to it again.

After duplication, Click Actions > Edit Code. Place the GTM Container in your Shopify Theme

Locate the Theme.liquid file. Keep in mind that if we add or edit code in this file, changes will be reflected on every page of your store with the exception of checkout.

We will now paste the GTM container code that you just copied from GTM. You can paste it right below the meta tags. Once you have ensured that you’ve pasted it correctly, save it in the next step. GTM code for theme mannual setup

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.

Step 3: Place the GTM Container in your Shopify Theme

The GTM container should be added to all pages on your Shopify store except for the checkout and thank you pages. 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
  • In the left-bottom corner, click on Settings
  • Click on Checkout
Place the GTM Container in your Shopify Theme Once you’re here, you will find a section called Order Processing. This allows us to add custom scripts to your thank you 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. Order Processing

This last code we edited in additional scripts will allow our code to be executed. Although you might not be able to track Checkout pages, using the Thank You page or any other page that signifies order completion, you will be able to track the purchases.

Step 4: Validate using GTM Debug Mode

Now it’s time to verify if our GTM tag is installed correctly in our store. 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.

  • Go to Google Tag Manager
  • In the top right corner, click on Preview GTM Preview
  • Type in your store’s URL and continue Tag Asssitant
This will open your store and you’ll see “Debugger Connected” in the bottom-right corner; if everything is installed correctly. Make sure that you visit a few different pages, and hard refresh them if you are not seeing any changes right away. Tag Asssitant Process 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.

Method 2: Using a Google Tag Manager – Shopify 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 of the most important events with correct data and share that with the third parties such as Google Analytics, Ads, Facebook Pixel, and many others.

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.

Each Shopify store is its own world with different apps and themes. Most stores have customized their theme in a unique way and that’s one of the reasons why the standard implementation might not work as expected. That’s why it is very important to receive support from the app team to make sure that tracking works accurately and smoothly.

It’s no surprise that we recommend Analyzify which is a versatile solution for Shopify Data Analytics. We have a world-class data and development team that has created an amazing solution and we also provide extraordinary support and free custom setup.

You should also make sure to check out other Shopify Google Tag Manager solutions in the market.

Final Words on Google Tag Manager - Shopify Setup

Adding GTM to your Shopify store 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.

Check out our FREE Google Tag Manager - Shopify Course on YouTube where we guide you through the process step by step while teaching the essentials of GTM.