How do I connect Google Analytics 4 (GA4) and Google Tag Manager to Shopify?
Connecting Google Analytics 4 (GA4) and Google Tag Manager (GTM) to your Shopify store helps you track visitor behavior, ecommerce conversions, and marketing performance accurately. Below is a clear, step-by-step setup guide for both tools.
Part 1: How to Connect Google Analytics 4 (GA4) to Shopify
The recommended method is using Shopify’s official Google & YouTube sales channel, which automatically enables enhanced ecommerce tracking.
Step 1: Create a Google Analytics 4 Property
- Sign in to your Google Analytics account.
- Click Admin → Create Property.
- Select Web as your platform.
- Enter your Shopify store URL (your custom domain or myshopify domain).
- Create the data stream and copy your Measurement ID (Format: G-XXXXXXXXXX).
Step 2: Install the Google & YouTube Sales Channel
- Go to Shopify Admin → Settings → Apps and sales channels.
- Click Shopify App Store.
- Search for Google & YouTube.
- Install and authorize the app.
Step 3: Connect GA4 to Shopify
- Go to Sales Channels → Google & YouTube.
- Under the Google Analytics section, click Connect.
- Select your GA4 property (or create one directly).
- Click Connect to finish setup.
Step 4: Verify Tracking
- Remove password protection from your store (if enabled).
- Visit your website and browse a few pages.
- In GA4, go to Reports → Realtime.
- You should see active users within a few minutes.
What GA4 Automatically Tracks in Shopify
Once connected through the Google & YouTube channel, Shopify automatically tracks:
- Page views
- Product views
- Add to cart
- Begin checkout
- Purchase
- Refunds
- Search queries
- Item list views and selections
No manual coding is required.
Optional: Link GA4 with Google Ads
If you run Google Ads campaigns, linking GA4 allows you to track conversions, build remarketing audiences, and analyze campaign performance. This is done inside your GA4 account under Admin → Product Links → Google Ads.
Part 2: How to Add Google Tag Manager (GTM) to Shopify
Google Tag Manager is used to manage multiple tracking codes (Meta Pixel, TikTok Pixel, custom scripts, etc.). It does not replace GA4.
Important: Avoid Duplicate Tracking
If you connect GA4 through Shopify’s Google & YouTube app, do not add GA4 again inside GTM. This can cause duplicate data and inaccurate reports.
Step 1: Create a Google Tag Manager Account
- Sign in to Google Tag Manager.
- Click Create Account.
- Select Web as container type.
- Copy your Container ID (Format: GTM-XXXXXXX).
Step 2: Add GTM to Shopify (Using Custom Web Pixels)
- Go to Shopify Admin → Settings → Customer Events.
- Click Add Custom Pixel.
- Name it (e.g., “Google Tag Manager”).
- Add your GTM container code.
- Save and publish.
This method works with Shopify’s upgraded checkout system and ensures compatibility with modern tracking standards.
Step 3: Configure Tags Inside GTM
- Open your GTM account.
- Click Add a New Tag.
- Select the tag type (GA4, Meta Pixel, TikTok Pixel, Custom HTML, etc.).
- Set triggers (when the tag should fire).
- Click Submit → Publish.
Step 4: Test Your Setup
- Use Preview Mode in GTM.
- Browse your store.
- Confirm tags are firing correctly.
- Check for JavaScript errors in the browser console.
Best Practices for Accurate Tracking
Do This
- Use Shopify’s built-in GA4 integration for ecommerce tracking.
- Use GTM for additional marketing pixels.
- Test everything before publishing.
- Monitor GA4 real-time reports regularly.
Avoid This
- Do not install GA4 through both Shopify and GTM.
- Do not skip testing before going live.
- Do not leave your store password-protected during testing.
Quick Setup Summary
For Google Analytics 4:
- Create a GA4 property.
- Install the Google & YouTube sales channel.
- Connect your GA4 property.
- Verify tracking in real-time reports.
For Google Tag Manager:
- Create a GTM container.
- Add it via Custom Pixel in Shopify.
- Configure tags and triggers.
- Publish and test.
Using Shopify’s native GA4 integration plus Google Tag Manager for additional tracking provides the most accurate and scalable analytics setup for modern ecommerce stores.
Related Answers
Still need help?
Talk to our Shopify experts
We've handled GDPR/CCPA compliance for dozens of EU & US Shopify stores.
