SOP 065: How to add Google Tag Manager to a Shopify Store
Add Google Tag Manager to a Shopify store and unlock a whole new world of tools and features to power up your Shopify Store.
Last Updated / Reviewed: 07/25/2024
Execution Time: ~5-10 minutes
🚀 Goal: To add Google Tag Manager to a Shopify store.
🤞 Ideal Outcome: Google Tag Manager is properly installed without any technical issues.
🤔 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 this is done: Only once—the first time you install Google Tag Manager.
👨 Who does this: The person responsible for website management or analytics.
__⚠️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.
Click here to get the most up-to-date version of this SOP
Environment Setup
01▸ Get the Google Tag Assistant Companion (Free).
Grab your Google Tag Manager container code
SCENARIO 1: If you don’t have a Google Tag Manager account yet
01▸ Sign up for Google Tag Manager (Free):
02▸ You’ll need to log in to your Google account.
03▸ You’ll be prompted to set up a Google Tag Manager account right away. Click “Create Account”.
04▸ Fill out your account details such as name, country, and website URL, and choose your preferred target platform. Click “Create”.
05▸ Accept the terms and conditions by checking the box below and clicking “Yes”.
06▸ 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.
07▸ 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
01▸ Log into your Google Tag Manager account;
02▸ On the top header click “Admin” → “Install Google Tag Manager”
03▸ 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, which only allows you to add GTM to the non-checkout pages unless you are a Shopify Plus customer.
Note 2: If you are a Shopify Plus customer, follow the official documentation laid out here.
01▸ Log into your Shopify store.
02▸ On the sidebar, under “Online Store” click “Themes”:
03▸ Click the kebab menu → “Edit Code”
04▸ On the search bar, search for “theme. liquid” → Click “theme.liquid”
05▸ Locate a section of the code that starts with “”. This should appear immediately on line 3 of the page. Paste the first snippet of code copied from Google Tag Manager right under :
Example:
06▸ Next, copy and paste the second code immediately after "":
Note: You may want to search "body" in the search box and remember to click “Save” in the top right corner whenever you've added a code under "
" or "".QA-ing your installation
01▸ Open your website homepage using Chrome.
02▸ Click on the Tag Assistant Companion Chrome Extension in your browser.
03▸ Click on “Add domain”
Enter your website’s URL and click “Connect”:
04▸ Check if the Tag Assistant is connected to your site. You should be able to see the below pop-up on your site when it is connected:
Note: If connection issues occur, you may refer to this link here to troubleshoot.