How to set up Google Tag Manager on Shopify

Erman Küplü
Better Shopify
Published in
4 min readMar 6, 2021

--

Google Tag Manager (GTM) is an exceptional tool, especially for Shopify stores that need accurate data collection to measure their marketing spends. While you don’t have much work to do when setting up GTM on Shopify, we will take you through several options to help you get it done.

Google Tag Manager — Shopify Integration

Before we dive in, here’s why you need GTM. Most importantly, GTM will help you find, organize, and process the data you have more effectively. Instead of collecting and sending data via several sources (like Facebook Pixel, Google Ads, or Google Analytics), GTM will read the data through dataLayers and process it in the way you like. By doing this, the tool allows you to share and access all data via any tool you would like.

The fact that it works within minutes is another impressive feature you should note.

So, how do you incorporate Google Tag Manager into your Shopify store?

Option 1 — Manual Installation: Insert GTM Code into Your Shopify Store

You can find a tutorial on this from Shopify. However, follow the steps below to understand the process better:

Step 1: Get your GTM container code.
You can create a new GTM account if you don’t have one, and you’ll immediately get a container code. You can find the code by clicking your GTM ID in your account.

Google Tag Manager Container Code

Step 2: Insert code into your theme files.
Go to “Shopify Admin.” Click on “Online Store,” then “Themes.” Go to “Your Themes,” then “Edit Code.”

Edit Shopify Theme Files

Search “theme.liquid” on the left search bar. Find the <head> tag within the file. Paste the GTM container right below the tag. Paste the GTM container code in the section right below the <head> code there.

Adding GTM Code into Theme.Liquid file.

Step 3: Insert code into your thank you page.
Now the GTM code will be shown on every page in your store except for the checkout processing and thank-you pages. It is time to do that!

Go back to your “Shopify Admin” section and click on “Settings.” Go to “Checkout” and then find “Order Processing” and then “Additional Scripts.” In the section there, paste your GTM container code too.

Add GTM Container to Shopify Checkout

Step 4: Validate & Debug
Run a check to see if the GTM container code has been safely installed in your Shopify store. Just go to your GTM account and click “Preview” in the top-left corner. Enter the URL and see.

Google Tag Manager Preview Tool
Debug Shopify Store in Google Tag Manager Preview Mode

If things have been done right, you should see the GTM Preview tool get active, and it should also display your tags. Everything should be ready, and your Shopify store should have a functional GTM component.

Note that this only allows you to activate GTM in your Shopify store. You still have to configure all GTM settings and tags manually. The step will work fine if you’re looking to add simple tags. However, if you would like more in-depth tracking, refine steps 2 and 3.

Option 2 — Use Analyzify

We’ve made it clear that you need to go beyond just installing the Google Tag Manager container. You also need a setup that incorporates GTM into your store and helps to provide optimal reporting. This is where Analyzify helps you out. In basic words, Analyzify is a Google Tag Manager app for Shopify stores.

With Analyzify, you have a suite that provides encompassing data analysis for Shopify stores. The tool allows you to set up GTM, Google Analytics 4, and Universal Analytics by simply injecting advanced dataLayers into your Shopify store. Analyzify already comes with pre-installed metrics and dataLayers for GA 4 and Universal Analytics Enhanced Ecommerce. So, you enjoy convenience and efficiency.

Analyzify is also cost-effective as it only comes with a one-time fee. In less than ten minutes, you can set it up and get it running. You can also contact us whenever you want for customer support.

Asides from merely setting up your Shopify store, Analyzify will provide some of the most important metrics for you. These include user frequency and monetary, user IDs, user recency, and more. The tool collects all these automatically, needing no input from you.

Analyzify is 100% compatible with Google Analytics 4.

Option 3 — Get Another GTM Shopify App

You can find several other Shopify apps for GTM. Ensure to check those out before you decide. Some of these include Littledata and Easytag.

--

--

Erman Küplü
Better Shopify

Learner 🔖 Co-created Analyzify — empowering 600+ #Shopify Merchants with accurate data 🏹 Co-founded Solverhood — completed 400+ projects on #Upwork