Skip to content

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

How do I connect Google Analytics 4 (GA4) and Google Tag Manager to Shopify?

SB
Written by StageBit Engineering Team
Updated February 2026 0 min readVerified by engineers

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

  1. Sign in to your Google Analytics account.
  2. Click AdminCreate Property.
  3. Select Web as your platform.
  4. Enter your Shopify store URL (your custom domain or myshopify domain).
  5. Create the data stream and copy your Measurement ID (Format: G-XXXXXXXXXX).

Step 2: Install the Google & YouTube Sales Channel

  1. Go to Shopify Admin → Settings → Apps and sales channels.
  2. Click Shopify App Store.
  3. Search for Google & YouTube.
  4. Install and authorize the app.

Step 3: Connect GA4 to Shopify

  1. Go to Sales Channels → Google & YouTube.
  2. Under the Google Analytics section, click Connect.
  3. Select your GA4 property (or create one directly).
  4. 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

  1. Sign in to Google Tag Manager.
  2. Click Create Account.
  3. Select Web as container type.
  4. Copy your Container ID (Format: GTM-XXXXXXX).

Step 2: Add GTM to Shopify (Using Custom Web Pixels)

  1. Go to Shopify Admin → Settings → Customer Events.
  2. Click Add Custom Pixel.
  3. Name it (e.g., “Google Tag Manager”).
  4. Add your GTM container code.
  5. 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

  1. Open your GTM account.
  2. Click Add a New Tag.
  3. Select the tag type (GA4, Meta Pixel, TikTok Pixel, Custom HTML, etc.).
  4. Set triggers (when the tag should fire).
  5. 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.

Was this answer helpful?

Your feedback helps us improve our answers.

Still need help?

Talk to our Shopify experts

We've handled GDPR/CCPA compliance for dozens of EU & US Shopify stores.

Talk to Shopify Experts

Tell us more about your brand!

Rohit Kundale, Our VP of Sales and Marketing is ready to meet with your team.