
Using Google Analytics & Tag Manager with Shopify
To grow your Shopify store, you need to know what’s working — and what’s not.
That’s where Google Analytics 4 (GA4) and Google Tag Manager (GTM) come in. Together, they give you deep insight into traffic sources, user behavior, product performance, and conversion paths.
In this post, we’ll show you how to properly set up GA4 and GTM with Shopify — and why it matters in 2025.
Why use GA4 with Shopify?
Google Analytics 4 is the new standard. If you’re still using Universal Analytics (UA), your data is no longer processing.
GA4 helps you:
-
Track sales, product views, and funnels
-
Measure marketing performance
-
Understand customer journeys
-
Enable remarketing and ad attribution
-
Create custom reports and segments
And it works seamlessly with Google Ads, GTM, and your Shopify data — if set up correctly.
Step 1: Set up your Google Analytics 4 property
If you haven’t already:
-
Go to analytics.google.com
-
Click Admin → Create Property
-
Choose GA4, not Universal Analytics
-
Add your store’s URL, timezone, and currency
-
Copy your Measurement ID (starts with
G-
)
You’ll need this to connect GA4 to your Shopify store.
Step 2: Add GA4 to Shopify (Basic Setup)
For a simple GA4 install without GTM:
-
Go to your Shopify Admin → Settings → Customer Events
-
Click Google Analytics 4
-
Paste in your Measurement ID
-
Enable Enhanced Ecommerce Events
This setup allows you to track:
-
Page views
-
Product views
-
Add to cart
-
Begin checkout
-
Purchases
💡 Make sure to test using Google’s GA4 DebugView.
Step 3: Set up Google Tag Manager (Advanced Tracking)
Want to track more than just basic ecommerce events? GTM is your tool.
To add GTM to Shopify:
-
Go to tagmanager.google.com and create an account + container
-
Copy the GTM container code (two snippets)
-
In Shopify, go to Online Store → Themes → Edit Code
-
Paste the
<head>
script into your theme.liquid before</head>
-
Paste the
<body>
script right after<body>
tag
Then publish the theme.
💡 Some Shopify themes or apps may conflict with GTM – always test.
Step 4: Track ecommerce events in GTM
To track ecommerce behavior, you can:
-
Use Shopify’s data layer (partial, not full GA4 schema)
-
Use third-party GTM containers like Elevar or Analyzify
-
Create custom tags and triggers (e.g., add-to-cart button clicks)
Common events to track:
-
Add to cart (click)
-
Scroll depth
-
Video views
-
Newsletter signups
-
Form submissions
-
Discount code usage
💡 Want 100% accurate GA4 ecommerce data? Use server-side tracking tools or a pre-built container.
Step 5: Validate your setup
Before going live:
-
Use Google Tag Assistant or Preview Mode in GTM
-
Check events in GA4 DebugView
-
Compare Shopify sales with GA4 purchase events
-
Set up Conversions in GA4 (e.g., purchase, lead, add to cart)
This ensures you’re not missing revenue, traffic, or funnel data.
Bonus: Connect GA4 to Google Ads
To improve attribution and retargeting:
-
Link GA4 to your Google Ads account
-
Import GA4 Conversions into Ads
-
Use GA4 audiences for retargeting
This gives you more accurate ROAS, better bidding, and smarter campaign optimization.
Final thoughts
Google Analytics and Tag Manager are essential tools in every Shopify store’s tech stack.
Set them up right, and you’ll unlock the insights you need to scale smarter, optimize faster, and grow consistently.
Need help with GA4 or GTM setup for Shopify?
At coi, we implement precise tracking solutions for D2C brands — from GA4 and GTM to Meta Pixel, TikTok, Pinterest and server-side tagging.