In this article, I will show you how to add Google Tag Manager (GTM) to your store within 5 to 10 minutes.

Google Tag Manager is a valuable tool that allows you to create much more data than with just Google Analytics alone. It is also a powerful platform that allows non-developers to easily create tags for tracking a whole variety of specific events.

A benefit of this guide is that this method will also work for store owners on the Shopify Basic plan. Something that you usually must be a Shopify Plus member to access.

You will need to check that you have already installed Google Analytics on your store. If not, then follow our Google Analytics guide on how to do so.

This guide has three steps:

  1. Get your GTM container code
  2. Add your GTM container code to your Shopify store
  3. Test to make sure GTM is working

Get your GTM container code

Create a Google Tag Manager account at tagmanager.google.com. A new Google Tag Manager container gets created for you.

For Shopify stores with an existing Google Tag Manager account. Log into your account and select your ‘Container’. Click ‘Admin’ on the top left menu and select the ‘Install Google Tag Manager’ option.

Two pieces of code are shared with you.

For the first piece of code, copy everything within the ‘script’ tags. Save it somewhere safe as we will also need to get a copy of the second piece of code.

First piece of Google Tag Manager code

For the second piece of code, you will want to copy all of it. Save this somewhere safe as well, for the next steps.

Second piece of Google Tag Manager code

Please remember to ‘Submit’ and ‘Publish’ your container.

Submit and publish Google Tag Manager container

Add your GTM code to your Shopify store

For this step, log into your Shopify store and select the ‘Online Store’ option under Sales Channels. Then click on ‘Preferences’.

Select Shopify online store preferences

Scroll down until you reach the ‘Google Analytics’ section.  Click on the ‘Add custom JavaScript to Google Analytics’ option.

Add custom JavaScript to Google Analytics

Within the box that appears, paste in the first piece of code that we got from Google Tag Manager. Once done, click on the ‘Save’ button.

Paste additional Google Analytics JavaScript to Shopify

For the next part, click on ‘Themes’ under ‘Online Store’.

Select Shopify Online Store themes

Then click ‘Actions’ and ‘Edit Code’.

Edit your Shopify store code

On the left-hand side, in the search field, look for ‘theme.liquid’. Typing in and searching for the word ‘theme’ is usually enough to find it.

With the ‘theme.liquid’ file open, search for a section of code that starts with ‘<body’. Paste the Google Tag Manager code directly below the ‘body’ tag.

Place Google Tag Manager code after body tag

Once done, click ‘save’ on the top right side of your screen.

The final step now is to make sure everything is working properly.

Test to make sure GTM is working

First, you’ll need to install the Tag Assistant (by Google) extension for Chrome.

Once done, open your Shopify store website in Google Chrome. Then click on the Google Tag Assistant icon in the top right corner.

Tag Assistant by Google Chrome Extension icon

A menu will show up asking if you would like to enable tag assistant in the browser tab.

Click enable on the bottom left of this menu.

Enable Google Tag Assistant Chrome Extension

Reload your Shopify store website to check for any Google Tag Manager issues on the current page.

Reload website on Google Chrome

After reloading, click on the Google Tag Manager icon to check that everything is working.

Congratulations, you have now installed Google Tag manager onto your Shopify store. The container will be included in all your pages, including checkout pages.

Subscribe to stay up to date

Your source for insider tips and resources for Digital Marketing and Ecommerce.

Thank you for your message. It has been sent.
There was an error trying to send your message. Please try again later.