Google has a fantastic range of tools and services that make managing your website easier and one such tool is Google Tag Manager (Shortened to GTM). As you will see below this is a vital asset for Shopify online stores and it can allow you to work more effectively.
If you are a first-time GTM user you may have no idea how this tool works on Shopify. Don’t worry as we have all been there and it can be confusing. To help we have created a simple guide below that explains the usefulness of Google Tag Manager and how to install it in under 5 minutes on your Shopify store.
What is Google Tag Manager?
- Google Tag Manager is an essential analytical tool for websites and apps. It’s not only useful for online stores but also for generic business websites.
- It is a tag management system that allows you to quickly add important data measurement code on your website. This is code you can use to track SEO metrics and other data so you can make your marketing strategies more effective.
- Most of the work for Google Tag Manager is done via the dedicated web interface and this is where you actually create the monitoring tags. You also need a snippet of code on your website to place the tags in and this is what you will learn to do below.
How to Install Google Tag Manager on Shopify
In this short guide we are explaining how to add the Google Tag Manager container code to your Shopify website. If you are unsure of anything or don’t feel confident enough to do this yourself you should seek the help of a Shopify SEO agency.
Step 1 - Copy the GTM Snippet Code
To complete this process we are assuming that you have already installed Google Analytics on your online store and have a Google Tag Manager account setup too.
We now need to get the container snippet code from our Google Tag Manager software so we can insert it into Shopify.
Login to your GTM account and click on the “Admin” button on the primary navigation. Click on “Install Google Tag Manager” and this should show two sections of HTML code.
In the first block of code, copy everything in-between the <script> tags (don’t include the actual tags). For the second block copy everything. (You may want to open Notepad and paste the two items). Always remember to publish your GTM container too so it’s live and to do this just click on the “Submit” button.
Step 2 - Navigate to Your Shopify Preferences
For now we are finished with the Google Tag Manager interface and you can return to your Shopify online store dashboard.
Once you have logged on to your Shopify account go to “Preferences” which is found under the “Online Store” tab.
Step 3 - Add the GTM Snippet Code To Your Preferences
If you have Google Analytics installed there should be an option to “Add Custom JavaScript to Google Analytics” that appears after you click on the online store preferences.
When you click on this a box should appear beneath that contains the <script> tags. Copy the first piece of code you selected from the Google Tag Manager dashboard and paste it here and then click save.
Step 4 - Add the GTM Snippet Code To Your Site HTML
You’ve now added the basic script that adds the GTM container to your Shopify store but now we need to paste the other code directly into the store’s HTML code.
Click on “Themes” which is found again under the online store tab and then click on the actions button at the top which should open a drop-down menu. From this sub-menu select the “Edit Code” option.
Using the search bar type in “theme.liquid file” and click on it. This should open the HTML code and you need to find the opening <body> HTML tag. Past the second piece of code you copied from GTM after the body tag but before the {% include ‘header bar’ %} line of code and then click the save button.
Step 5 - Test to Check the Installation Was Succesful
Thats it! The most important thing is that you paste the second piece of code in the right place otherwise it could break your online store.
To test if it has worked we can use the Google Tag Assistant Extension. This is a Google Chrome extension and when it is installed simply open your Shopify website and click on the Tag Assistant icon at the top of Chrome.
A pop-up should appear – just click on the “enable” button, refresh your browser and open the tag assistant extension again. If the installation was successful you should see an analysis box showing the Google Tag Manager code.
Installing Google Tag Manager on Shopify is quite easy as you can see but the real fun comes from creating the different tags and then incorporating them into your online store. Whenever you add a new piece of code into your store like this we always advise testing it thoroughly before making any live changes as you don’t want to introduce something that could break your site and make it unusable even for a brief period.
Joshua George is the founder of ClickSlice, an SEO Agency based in London, UK.
He has eight years of experience as an SEO Consultant and was recently hired by the UK government for SEO training. Joshua also owns the best-selling SEO course on Udemy, and has taught SEO to over 100,000 students.
His work has been featured in Forbes, Entrepreneur, AgencyAnalytics, Wix and lots more other reputable publications.