This is the FIRST thing I do whenever I start a new website.

Google Tag Manager allows you to easily deploy code and tracking pixels to your site without the need to edit the code of asking your developer to do it.

There are two important things to mention about the I’ll explain here:

  1. Unlike the official Shopify process, which only adds Google Tag Manager to the non-checkout pages unless you’re an enterprise customer using Shopify Plus, the method I’ll explain will allow you to add Google Tag Manager to your entire website (including checkout pages). This is super important if you’re using Google Tag Manager for tracking or remarketing.
  2. For this method to work, you need to have already installed Google Analytics on your Shopify website. If you haven’t, you can follow this walkthrough to do that.

The entire process to add Google Tag Manager to your Shopify site should take no longer than 5 minutes.

Sidenote: if you’re not using Squarespace, check out our guides for WordPress or Squarespace.

Now let’s get started.

If you want to save this tutorial for later, you can download a copy through the form below.

Get This Entire Walkthrough and All the Resources in This Post

Getting your Google Tag Manager container code

First, you’ll need to grab the Google Tag Manager code from your account.
  • If you don’t have an account yet, sign up for Google Tag Manager and set up your account. You’ll get your code right away.
  • If you already have a Google Tag Manager account for this website, log into your account, click “Admin” on the top navigation, and then click “Install Google Tag Manager”.

You’ll see two pieces of code.

From this first piece of code, copy everything between the “script” tags (excluding the actual tags). You will need it in the next chapter.

Below that, you will find another piece of code. You can copy this whole thing and save it for the next chapter.

If this is your first time using Google Tag Manager, remember to publish your container by clicking “Submit” and then “Publish”.

Adding Google Tag Manager to your Shopify store

In this step, you'll add the code you got from Google Tag Manager to your Shopify site.

Log into your Shopify store and click on “Preferences” under “Online Store”.

Click “Add custom JavaScript to Google Analytics”.

Paste the first piece of code you got from Google Tag Manager on the previous step, and click “Save”.

Next, click on “Themes” under “Online Store”.

Click “Actions” and then “Edit Code”.

On the search bar, search for and select “theme.liquid”.

Locate a section of the code that starts with “<body” you can either scroll down until you find it or you can just use your browser’s search feature (typically Ctrl+F for PC, and ⌘+F for Mac).

Paste the second piece of code that you got from Google Tag Manager there:

Here’s how it should look:

Finally, click “Save” in the top right corner.

All that’s left is to check and see if everything is working properly.

Testing your installation

To wrap things up, let's make sure everything is working correctly.

To test, you’ll need to install the Google Tag Assistant Extension on Google Chrome.

Once you’ve done that, open your website and click on the Google Tag Assistant icon. 

Click on “Enable”.

Refresh the page and click on the Google Tag Assistant Chrome Extension again.

You should see a green tag for Google Tag Manager, indicating that the installation was successful.

That’s it!

If you’ve followed all the steps until now, you’ve now installed Google Tag Manager on your Shopify store and the container will be included in all your pages—including checkout pages.

Double Conversions With Laser-Focused Google Analytics

Get the 2021 Ultimate Guide to Perfect Google Analytics Tracking sent to your inbox.