How to Add Google Tag Manager to Your Shopify Store

How to Add Google Tag Manager to Your Shopify Store
Written by
Richard Emanuel
Published on
October 6, 2020
Read time

Shopify and Google Tag Manager are two of the most powerful tools in their respective fields. Shopify has become the go-to e-commerce solution for online retailers for a few years now. Moreover, Google Tag Manager is fast becoming the preferred data tool for websites. If you’re wondering why and how to integrate the Google Tag Manager with the Shopify e-commerce platform, then you’re on the right page.

Google Tag Manager: A Brief Introduction

Until the introduction of the Google Tag Manager (GTM), website administrators and developers had no other choice but to inject tags and tracking snippets directly into the website backend code. Nowadays even small e-commerce websites require tracking hundreds of events and actions, and adding multiple code snippets to the website backend is fraught with danger. A small error – a missing or misplaced tag - can break the webpage or worse wreck the whole website.

The Google Tag Manager provides an easy-to-use interface to add and manage all the tags of the e-commerce store, irrespective of the size of the website. The GTM tool frees you from tweaking the website code every time you want to track an event or action.The small code snippets that are called tags help the marketer study consumer behavior and website performance. They provide valuable data that can serve as the basis for any future marketing and sales effort by the e-retailer.Interestingly, GTM serves no real purpose to the administrator if used alone. Google Tag Manager is useful to a Shopify website only when it’s used along with Google Analytics. They complete each other and work in tandem to achieve the administrator’s goals, which is to manage the store and boost its sales effectively.

Many Reasons to Use Google Tag Manager

Google Tag Manager is free. Not only does the tool save you money, but it also prevents you from unnecessarily meddling with the website code, saves you valuable time, and helps increase the sales.

GTM doesn’t come empty-handed; it brings goodies for the administrators in the form of most common tags and triggers. You’re spared from creating the tags from scratch; use the ones already built-in the tool. Also, the tool also provides templates for Google AdWords, Google Analytics, Facebook Pixel, and other tracking tools.The tool is safe to use, for business websites and Shopify stores. That’s because you have total control over all the permissions of the website.With Google Tag Manager by your side, nothing escapes your notice. The all-seeing eye tells you exactly how many people have subscribed to your newsletter, submitted forms, viewed the recommended products section, added items to the shopping cart, etc. It can also tell from where the visitors come from – Facebook, Instagram, YouTube, or Google Search Page.

Things you need to add GMT to Shopify

By now it must be quite clear to you the essentials before you install Google Tag Manager in your Shopify store. There is no harm in reiterating. You’ll need the login credentials of the following accounts:Google Analytics: There is no GTM without the tracking tool Google Analytics. It’s one of the best tracking and reporting tools out there, and it’s free. If you don’t have a Google Analytics account; create one now.Google Tag Manager: Creating a GTM account is the first step of the process.Shopify Store: User account with limited access won’t do. You need to have an administrator account to add GTM to Shopify.Now, let’s get started.

Creating a Google Tag Manager Account

This section is for those who don’t have a GTM account. Skip this section if you already have one.Visit the GTM website and use your Google Analytics login credentials (Gmail ID, Username, and Password) to get in.Next, you’ll be taken to create a new GTM account. Give your new account a name and click ‘Continue.’The next step is to add a container to the new account. Choose ‘web’ if the tag manager will be used on a website.On clicking the ‘Create’ button, a pop-up window with terms and conditions will appear on the screen. Go through the text and if you have no objection to the terms click ‘Accept.’A new pop-up with two code snippets will appear. Copy the codes or leave the page open and head to your Shopify store.

How to access code snippets if I already have a Google Tag Manager account?

Login to Google Tag Manager Website; on the ‘admin’ page click on the ‘Install Google Tag Manager’ link under the ‘Container’ section. You’ll be taken to the two code snippets page.

Adding the container code snippets to the Shopify store

Use your Shopify admin account credentials and login to the store. The two pieces of code are to be positioned in two different places in two different pages (theme.liquid file and checkout.liquid file). Here is what you should do:Task #1Copy the first code snippet (the one to paste in the Head section).Go to the Shopify admin page and follow this path: Online Store à Themes à Edit Code.Access the theme.liquid file and enter the code in the Head section, preferably just under the <head></head> tag or as high in the section as possible. Now, save the file.The code has a second home – the checkout.liquid. Open the file and paste the code snippet just under the <head></head> tag. Now, click ‘Save.’Half the job is done.Task #2Now, revisit Google Tag Manager and copy the second code snippet (the one to place in the Body section).From the Shopify admin page, follow the same path mentioned above to access the theme.liquid file.On the theme.liquid file place the code snippet in the body section, as high as possible. Save the file.Open the checkout.liquid file and paste the same code under the <body></body> tag. Now, save the file.Voila! It’s done.

Steps to Verify Installation of Google Tag Manager

Congratulations, the Google Tag Manager is part of your Shopify platform. However, if you’re not sure, then this can be verified using two simple methods.Method #1:On Google Chrome, search for Google Tag Assistant and add the extension to the browser.Open a new tab and type the address of your e-commerce store.When your Shopify store has fully loaded, click Google Tag Assistant and press the ‘Enable’ button at the bottom.Then, refresh and reload the Shopify store page and open the Google Tag Assistant extension again.You’ll see both GTM and Google Analytics appear on the pop-up box. If not, try the second method.Method #2:Google Tag Assistant is not always correct; sometimes it can show an error where there is none. Hence, it’s better to be doubly sure before you check where you have gone wrong or install the GTM tool again.Login into your store’s Google Analytics account and look for real-time visitors. If you see any, it means you have successfully integrated Google Tag Manager in your Shopify store.References: