Skip to content
English
  • There are no suggestions because the search field is empty.

How to add Google Tag Manager to a Shopify Store

Goal
To add Google Tag Manager to a Shopify store.

Ideal Outcome
Google Tag Manager is properly installed without any technical issues.

Prerequisites or requirements

You need to have Google Analytics on your store. If you haven’t done it yet, you can follow SOP067 (web version) to set up Google Analytics for Shopify.

Why this is important
Google Tag Manager is a great tool to add and manage multiple pixels and tracking codes without needing to edit the code of a site.


Where this is done
In your Shopify admin panel and Google Tag Manager.

When is this done
Only once—the first time you install Google Tag Manager.

Who does this
The person responsible for website management or analytics.

Environment Setup

Download and install the Google Tag Assistant Chrome Extension (Free)

Grab your Google Tag Manager container code

SCENARIO 1: If you don’t have a Google Tag Manager account yet:


  1. Sign up for Google Tag Manager (Free):



  1. You’ll need to log in to your Google account.

  2. You’ll be prompted to set up a Google Tag Manager account right away. Click “Create Account”.

  1. Fill out your account details such as name, country, and website URL, and choose your preferred target platform. Click “Create”.

  2. Accept the terms and conditions by checking the box below and clicking “Yes”.

  1. Next, a pop-up will appear where you will see your Google Tag Manager code. Please remain this page open until the next chapter. You will need to copy the first and second snippets of codes into your Shopify Store later.

  1. Once you are in your Workspace, click on Submit > Publish > Continue to publish your Google Tag Manager container:









SCENARIO 2: If you already have a Google Tag Manager account:


  1. Log into your Google Tag Manager account;

  2. On the top header click “Admin” → “Install Google Tag Manager”


  1. Copy the code below. You will need it in the next chapter.


Below the first snippet of code, you will have a second one. Remain this tab open to copy the second code and paste it into your Shopify store later.

 

Adding Google Tag Manager to your Shopify Store

Note: This method allows you to add Google Tag Manager to your whole website in contrast to the official documentation that would only allow you to add GTM to the non-checkout pages unless you are a Shopify Plus customer.


If you are a Shopify Plus customer, follow the official documentation laid out here .


  1. Log into your Shopify store.

  2. On the sidebar, under “Online Store” click “Themes”:

  1. Click the kebab menu → “Edit Code”

  1. On the search bar, search for “theme. liquid” → Click “theme.liquid”

  1. Locate a section of the code that starts with “<head>”. This should appear immediately on line 3 of the page. Paste the first snippet of code copied from Google Tag Manager after line 3 under <head>:


Example:



  1. Click “Save” in the top right corner:


  1. Next, copy and paste the second code immediately after the opening of <body> tag or paste it after line 246 under <head>:


  1. Again, click “Save” in the top right corner:


 

QA-ing your installation

  1. Open your website homepage using Chrome.

  2. Click on the Tag Assistant Companion Chrome Extension .

  3. Click on “Enable”

  4. 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.