Setting Up Google Tag Manager with Shopify: A Complete Walkthrough
Share
Setting Up Google Tag Manager with Shopify: A Complete Walkthrough
Introduction:
Google Tag Manager (GTM) makes it easy to manage tracking codes without touching the codebase constantly. For Shopify stores, GTM enables precise tracking of user actions, conversions, and marketing performance.
Why Use Google Tag Manager with Shopify?
-
Add and update tracking codes (GA4, Meta Pixel, etc.) easily
-
Track custom events like button clicks, form submissions, and purchases
-
Reduce reliance on developers for code changes
-
Improve tag deployment speed and debugging
Step-by-Step Setup Process
Step 1: Create a GTM Account
-
Go to tagmanager.google.com
-
Create a new account and container
-
Choose “Web” as the container type
-
GTM will provide two code snippets
Step 2: Add GTM to Your Shopify Store
For Shopify Basic:
-
Go to Online Store > Themes > Edit Code
-
Open
theme.liquid
-
Paste the
<head>
part of GTM code before</head>
-
Paste the
<body>
part right after<body>
For Shopify Plus:
-
Use Shopify's checkout.liquid file for deeper integration during checkout
Step 3: Set Up Google Analytics 4 via GTM
-
In GTM, create a new Tag
-
Tag Type: Google Analytics: GA4 Configuration
-
Enter your GA4 Measurement ID
-
Trigger: All Pages
-
Submit and publish the container
Step 4: Set Up Conversion Events
-
Example: Purchase event on order confirmation page
-
Use a Page View Trigger for URLs containing
/thank_you
-
Tag Type: GA4 Event Tag
-
Event Name:
purchase
-
Add custom parameters (e.g., value, currency, transaction_id) using Data Layer Variables
Step 5: Test with Preview Mode
-
Click “Preview” in GTM and enter your Shopify store URL
-
Navigate through your site to see what tags fire
-
Fix any broken triggers or tag misfires before publishing
Best Practices
-
Always use GTM’s preview mode before going live
-
Document every tag and trigger for clarity
-
Regularly audit tags to remove outdated or unused scripts
Conclusion
Setting up GTM on Shopify gives you granular control over your marketing and analytics tools. Whether it's GA4, Meta Pixel, or custom events, GTM simplifies tracking implementation and keeps your site running efficiently.
Need help setting up GTM or optimizing your Shopify tracking?
👉 Let RootSyntax help you build a conversion-ready eCommerce analytics setup.