Shopify Basics | Updated September 7, 2022  

2 Ways To Add Shopify Google Tag Manager in Minus 2 Minutes. The No-Fluff Non Technical Guide

by Kiril Kirilov

A successful eCommerce business is more than about understanding your user behavior. It is important to have detailed analytical data on event tracking for better data-driven decisions. 

A better understanding of customer movements on your Shopify site will help you understand the shortcomings — and guide you towards better choices. 

Shopify Google Tag Manager is a one-stop solution for all this data. You can extract more meaningful insights into audience movements and do a better analysis with them. 

Here is how to add Google Tag Manager to Shopify eCommerce business. 

Setting Up Shopify Google Tag Manager

There are two ways to add Google Tag Manager to your Shopify store. 

  1. By Google Analytics Setting: If you set up GTM via Shopify Admin Setting, it will cover all pages, including thank you and checkout pages. 
  2. By Theme File: With this method, you won't be able to cover all of your Shopify store pages. Instead, you will have to configure the thank-you and checkout pages separately.

Let's cover each of them. 

Setup GTM via Shopify GA Setting

Step - 1: Copy the Universal Google Analytics Script

Head over to Google Analytics, and select the account and property.

Select the Tracking Info option and copy the Tracking code.

Step - 2: Paste the Code into Shopify Admin Google Analytics Section.

Log in to your Shopify account and click on the Online Store option underneath the Sales Channel. Move forward with Preferences

You will have to scroll down a little to find the Google Analytics option on this page. 

Here, paste the code and save changes.

Step - 3: Copy the <head> Snippets from GTM

Log in to your Google Tag Manager account > Admin > Install Google Tag Manager
Copy the <head> code without <script> </script> tags. 

Come back to your Shopify account, paste that GTM <head> code in the Additional Google Analytics Javascript section, and save the changes. 

All done. You don't have to use the <body> snippet in this process. Moreover, you don't need to install it separately on checkout and thank-you pages.

Setup Google Tag Manager via Shopify Theme File

Step - 1: Find the Code Snippets in GTM

Head over to your GTM account and click on the Admin option. Click on the Install Google Tag Manager option, where you will find two code snippets. 

Snippet#1 or <head> code has to be placed on the head tag of the page - as high as possible. However, Snippet#2  or <body> code has to be placed in the page's body tag. 

Step - 2: Paste the Snippets Code in Shopify Theme.liquid File

Log in to your Shopify store account and click on the Online Store option given under Sales Channel.

Head over to the Actions option and move forward with Edit Code.

On the next screen, select theme.liquid and navigate to the top of the code. Copy the <head> code and paste it over here. 

Now scroll down to the bottom where the <body> tag begins. The position of this code could be different depending on the website. 

Paste the <body> code here and save the changes you made.

Though this method is easier than the above, you'd need to configure thank-you and checkout pages separately. 

Here is how to do this.

How to Install Google Tag Manager on Thank You Page?

Copy the <head> and <body> code from Google Tag Manager. 

Head over to the Settings section in your Shopify store. Select checkout from the available options. 

Scroll down a little to find Additional scripts under the Order Status Page. Paste both codes in their order and Save changes. 

You're done. 

How to Test GTM Configuration?

Head over to your GTM account and click over the workspace section. Here you will find the Preview option if initial tags are already set up. 

However, if you haven't set up any versions and tags, the Preview option won't be available. 

To create an initial version, click on the Submit button. Add the name and description of the version and hit the publish button. 

Now, you will be taken to the Google Tag Assistant. Add your Shopify store URL and then click on the Connect button. 

Once connected, a pop-up message will appear on the screen to verify the connection.

How to Set Up Enhanced eCommerce Tracking via Google Tag Manager

Enhanced eCommerce tracking gives you access to data like page views, product purchases, impressions, and promotions. To get all this data in Google Analytics, you need to configure the Google Analytics universal Code on each product page. 

There are two possible methods to do this. 

  1. Using a custom Javascript Macro
  2. Using a Data Layer

The custom javascript way might need help from an expert developer who has command of coding. However, if you want to handle things yourself, the data layer method is much more convenient. 

The data layer will store the data and information from Google Tag Manager and transfer it to Google Analytics. This way, you can keep track of everything in your GA account. 

Here is how to set up enhanced eCommerce tracking using GTM. 

Setup and Enable Universal Analytics

In your Google Analytics account, select the Account and Property of your Shopify store. If you haven't created it before, you can make it within seconds. 

Click on Create Account option. Specify a unique Account Name and click on Next.

Specify the Property Name, Reporting time zone, and Currency. Then click on Show Advanced Options

Here, enable the Create a Universal Analytics Property toggle. Please note that the Universal Analytics property will stop collecting data in 2023 but right now, GA 4 isn't compatible with Shopify. 

Once you click on the toggle button, you will be presented with further options. You need to input your website URL and select Create a Universal Analytics property only.    

Once done, click on the Next button. 

Now, add your business details, including business industry, size, and how you want to use GA for your business. You can check the options you want to use. 

Next, there will be a pop-up to accept GA Terms and conditions

On the next screen, you will see Web stream details. Select the Add new on-page tag in the Tagging Instructions and click on the Google Site Tag option. 

A gtag.js script code will appear. Copy the code and head over to your Shopify store

Select Online Store > Preferences in the Shopify menu. Scroll down a little to find the Google Analytics option, paste the code here, and Save changes. 

You have to make sure that you have removed password protection from your online store. If not, GA won't be able to track online visitors. 

Enable eCommerce Tracking

Now head over to your Google Analytics account. Select the right account and property and head over to the view column. In the View column, click on the eCommerce Settings option.

Now, turn on the toggle button to enable eCommerce and enhanced eCommerce reporting. Then click on the Save button.

Enable Enhanced eCommerce Tracking

Back in your Shopify admin page. Head over to Online Store > Preferences > Google Analytics > check the Use Enhanced eCommerce option and Save settings.

What Type of Data Can I Collect with GTM Enhanced eCommerce Tracking?

With Google Analytics Enhanced eCommerce Tracking, you can track insightful data like product impressions, page views, sales, and promotions with pageviews and events. You can use pageviews to track product purchases and impressions. However, you need to use events for checkout steps and product clicks. 

Here are the enhanced eCommerce data types. 

  • Impression data: tracks the views or impressions coming to a product.
  • Product data: refers to actions taken for an individual product such as viewed, added to cart, etc.
  • Promotion data: tracks the footprints of a viewer coming from a promotional campaign.
  • Action data: It refers to actions taken for an eCommerce product.

To plan your implementation for better data analytics, it is best to review the Enhanced eCommerce Data Type and Actions section from the developer's guide.

Can I use Google Tag Manager in Shopify Plus?

You can use Google Tag Manager or GTM in your Shopify Plus account. However, you need to check a couple of things before getting started. 

  • Make sure you have access to the checkout.liquid file. If not, it is better to contact Shopify Plus support.
  • Copy the Google Tag Manager Code snippets and paste them into the theme.liquid and checkout.liquid files.

You can easily use Google Tag Manager in Shopify Plus with access to these files. However, users who do not use Shopify Plus can still use GTM. They have to follow the theme.liquid method mentioned above.

How to Improve Post-Purchase eCommerce Experience with Google Analytics?

Google Analytics is a great source of getting insightful and detailed data on where your customers are coming from, how they are interacting with your Shopify store, product purchase, product clicks, and retention time. 

Though, the data can help identify and optimize the customer journey. But if the target is to improve the post-purchase experience, it is better to use a dedicated app

Rush.app is a good option to get your hands on actionable data. You can use this data to improve your customer experience, marketing campaigns, and Average Order Value (AOV) on your Shopify store. 

The plus point? Rush is offering a 30-day free trial you can avail yourself to get started.

Kiril Kirilov is co-founder at Rush - Increase sales and boost customer retention rates. Rush automates the shipment tracking process on all fronts so you can turn your loyal customers into "human ATMs"