5-Steps to Add Google Tag Manager to Shopify

5-Steps to Add Google Tag Manager to Shopify

In this article, I share 5-steps to add Google Tag Manager to Shopify. This should take 5-minutes or less to complete.

(Note – In this article, I’m not covering how to set up marketing tags for Universal Analytics, Google Analytics 4, Google Ads, Facebook Ads, and other integrations. To keep this brief, I’ll cover these related topics in subsequent articles.)

Why Use GTM on Shopify?

If you want to run profitable digital marketing campaigns for your Shopify store, you must track every meaningful step of your checkout process.

This helps you understand the effectiveness of individual marketing campaigns… customer journey… customer lifetime value… ROI of your various products… content effectiveness… and so on. As a result, you can learn where exactly to focus your resources so you grow your business.

Basic Shopify comes with some analytic capabilities called Shopify Analytics. This displays purchases, revenue, refunds, and even UTM data for referral traffic from other sites.

Universal Analytics is also a native Shopify integration that includes Enhanced Ecommerce Tracking. But Shopify only sends this conversion data to Universal Analytics and not to Google Ads.

Also, if you’re running Facebook ads, there are currently major issues with Facebook Pixel and Facebook CAPI not de-duplicating properly (hundreds of store owners complaining about this on Reddit)… so you end up double-counting conversions. This in turn screws up the reporting and profitability of your ad campaigns.

Lastly, there’s still no support for Google Analytics 4 – Google’s much improved Google Analytics product.

This means if you’re relying on Basic Shopify default features, you’re likely missing out on many profit-improvement insights.

Google Tag Manager (or GTM for short) unlocks the full power of your conversion tracking & analytics power of your ecommerce data. The only downside is, you normally have to upgrade to Shopify Plus, starting at $2,000 per month. (Fine if you’re an enterprise customer but hard to justify for smaller stores.)

The good news is, our solution doesn’t require Shopify Plus. You don’t even need a Shopify app for this to work.

So now we’ve covered the ‘why’ let’s go over how to set it up:

5-Steps to Install Google Tag Manager on Shopify

Step 1- Create a Google Tag Manager Container

Head on over to https://tagmanager.google.com/ and click Create Account to create a new Google Tag Manager account (if you don’t have one already).

google tag manager account

Give your account an appropriate name. for example, your business name.

Select your country.

Name your container. I normally use the domain name of the store as a name.

Then choose “Web” as the target platform.

create google tag manager container

Step 2 – Get Your GTM Code Snippets

Once you accept Google’s terms (if this is your first time using Google Tag Manager), you’ll see the dashboard for your new web container.

You will also see a popup containing two code snippets… one for the <head> and the other for the <body>.

Copy and paste these into a notepad. We’ll use them in just a moment.

gtm code snippets

Step 3 – Add GTM to Shopify Liquid Theme File

Now that you have your GTM head and body snippets, it’s time to add them to your Shopify store.

To do so, log in to your Shopify account.

In the left-hand sidebar, click the “Online Store” link.

Shopify sidebar

Click the “Actions” button, and choose “Edit” to open the Shopify theme editor.

Shopify theme editor

The theme.liquid file should open by default. If it doesn’t, click the link in the left side panel labeled “theme.liquid“.

There are two places to paste the code snippets you grabbed earlier. Note – you have a <head> snippet as well as a “body” snippet. Each one must be pasted in the right place.

Paste the code snippet just after the opening <head> tag. This code actually loads Google Tag Manager.

GTM head snippet to add google tag manager to Shopify theme.liquid

Now, scroll down until you see the opening <body> tag and paste the second code snippet (see the blue outline in the image below). This handles the scenario when a user’s browser doesn’t allow Javascript to run.

Add GTM body snippet to theme.liquid

Click the green “Save” button to update your Shopify theme.

Step 4 – How to Add Google Tag Manager to Shopify Checkout?

Now the GTM container code will load on all of your main pages.

At this point your setup is capable of tracking e-commerce events such as Page View, View Item, Add To Cart and Checkout, but NOT Purchase completion… unless of course, you’ve upgraded to Shopify Plus.

As a result, we have one more step in order to enable event tracking for Purchase actions.

This requires adding the GTM code snippet to your “Checkout Settings”.

Let’s go there now.

First, click the “Settings” link at the bottom of the left-hand sidebar of your Shopify admin.

Shopify settings

Click “Checkout”.

Shopify checkout settings

Then scroll down until you see the section labeled “Additional Scripts”.

Paste your <head> code snippet in the box provided.

Shopify checkout additional scrips - GTM script

Step 5 – Verify GTM Snippet is Installed Correctly

Finally, you need to check everything’s working correctly.

In your Google Tag Manager container dashboard, click the “Preview” button in the top right-hand corner of the page.

Google Tag Manager preview mode

Enter the URL of your store in the Tag Assistant popup that appears.

Google Tag Manager Assistant popup

Now, in the bottom right-hand corner of your screen, you should see an overlay box displaying the word “Connected”. This indicates the correct Google Tag Manager tag is found installed on your site.

Tag Manager connected confirmation

Following these 5-steps, you should have your Google Tag Manager installation loading in your Shopify website in just a few minutes.

In future articles, I’ll go into detail on how to use Google Tag Assistant to debug your setup. This is essential for getting all of your conversion tracking, analytics, and other integrations working correctly.

Next Steps

Installing the GTM code on your Shopify pages is just the beginning. Next, you need to consider:

  • The conversion events involved in your checkout process, including Page View, Add to Cart, Checkout, Purchase, Email Registration, etc.
  • The transaction data you need to know about each action including product name, product id, number of items, category, price, tax, shipping, transaction id, etc.
  • The platforms you need to send data to that may include any of the following… Universal Analytics, Google Analytics 4, Google Ads, Facebook Ads, Taboola, Outbrain, Pinterest Ads, Twitter Ads, Mixpanel, Hotjar, and custom HTML .
  • The tracking codes and marketing tags, along with the triggers and variables that you need to set up.

If this all feels overwhelming, don’t worry! Rome wasn’t built in a day.

First, get the GTM code installed. Next, get Google Analytics and Enhanced Ecommerce working via Google Tag Manager, along with all of your events showing up properly in your Google Analytics Account.

Then you can add other tracking tools and integrations, as you need them.


We’ve covered a lot here. Hopefully, it all makes sense!

You might find the 5-steps covered here easier to follow if you check out the accompanying Youtube video.

If you have any questions please leave them in the comments below.

Also if you’ve found this content valuable, please like and share. It helps others who are struggling to improve their Shopify tracking too. Thanks!