How to Set Up GA4 and Tag Manager Correctly on Shopify
Share
How to Set Up GA4 and Tag Manager Correctly on Shopify
Tracking your Shopify store performance accurately is critical in 2025 — and that starts with properly configuring Google Analytics 4 (GA4) and Google Tag Manager (GTM).
This step-by-step guide will walk you through the right way to set up both GA4 and GTM on Shopify — the clean, reliable way.
🔹 Why Use GA4 with GTM Instead of Shopify’s Native GA Integration?
Shopify’s native GA4 support is limited. Using Google Tag Manager gives you:
-
Flexible tracking (events, conversions, scroll depth, form submits, etc.)
-
Centralized script management
-
Easy debugging with preview mode
-
Clean future upgrades without theme edits
✅ Step 1: Create a GA4 Property
-
Go to Google Analytics
-
Click Admin > Create Property
-
Choose Web > Shopify URL
-
Save your Measurement ID (looks like:
G-XXXXXXXXX
)
✅ Step 2: Create a GTM Account
-
Visit Google Tag Manager
-
Click Create Account and enter your Shopify store details
-
Select Web as the container type
-
After setup, copy your GTM container ID (like
GTM-XXXXXXX
)
✅ Step 3: Add GTM Code to Shopify Theme
-
In your Shopify admin, go to:
Online Store > Themes > Edit Code -
Open
theme.liquid
-
Paste the GTM
<head>
snippet just after the<head>
tag -
Paste the GTM
<noscript>
snippet right after the<body>
tag
⚠️ Note: If you’re using a Shopify 2.0 theme with sections, confirm you're editing the right layout file (
theme.liquid
, notlayout.liquid
)
✅ Step 4: Add GA4 Tag in GTM
-
Go to Google Tag Manager > Tags > New
-
Choose GA4 Configuration
-
Paste your Measurement ID
-
Trigger: All Pages
-
Save and publish your GTM container
✅ Step 5: Test Everything
-
Use Tag Assistant or GTM Preview Mode
-
Check GA4 > Realtime to confirm pageviews are tracked
-
Test key events like add-to-cart, purchase (can be added with GTM triggers)
🔄 Bonus: Track Shopify Events with GTM
With GTM, you can track:
-
Add to Cart
-
View Product
-
Begin Checkout
-
Purchase
-
Form Submissions
-
Scroll Depth
Use Shopify’s dataLayer
or custom triggers for precision.
⚠️ Common Mistakes to Avoid
-
❌ Adding GA4 and GTM separately → causes double tracking
-
❌ Forgetting to exclude your IP address
-
❌ Not testing events before launch
-
❌ Ignoring cookie banner compliance for GDPR/CCPA
🚀 Final Thoughts
A clean GA4 + GTM setup gives you complete visibility into your store’s performance. Don’t rely on default tracking — configure it properly once, and scale confidently.
🛠️ Need help setting up advanced tracking for your Shopify store?
👉 RootSyntax.com – Shopify Analytics Setup Done Right