How to Install Google Analytics 4 on Shopify the Right Way
Shopify
9.9.2026

How to Install Google Analytics 4 on Shopify the Right Way

Three methods, zero duplicate tags, and the post-install checks most guides skip

Installing GA4 on Shopify takes five minutes. Installing it correctly — without duplicate events, missing checkout data, or inflated revenue numbers — takes a bit more intention. This guide walks you through every step, flags the mistakes that silently wreck your reports, and tells you exactly when the native integration is enough versus when you need something more.

Why 'Just Installing GA4' Is Not Enough

A broken GA4 setup is worse than no setup at all. Inflated pageviews, duplicate purchase events, and missing mid-funnel data will lead you to make decisions based on numbers that simply aren't real. Before touching a single setting, it helps to understand what can go wrong — and why it goes wrong so often on Shopify specifically.

Shopify's checkout is a sandboxed environment. Standard JavaScript snippets can't fire freely inside it the way they can on a regular webpage. That architectural quirk is the root cause of most GA4 tracking gaps on Shopify stores. Add the fact that ad blockers and Safari's Intelligent Tracking Prevention (ITP) silently drop a share of browser-side events, and you can see why a careless install produces data you can't trust.

A poorly executed GA4 setup can lead to misleading reports, missed conversions, and wasted advertising budgets — making it difficult to optimise your store or make business decisions with confidence.

The good news: Shopify has improved its native GA4 integration significantly. For most stores, one of the three methods below will get you clean, reliable data without writing a single line of code.

Method Comparison at a Glance

Method Technical skill needed Checkout coverage Custom events Best for
Google & YouTube app (native) None ✅ Yes Limited Most Shopify stores
Google Tag Manager + Custom Pixel Intermediate ✅ Yes (via Web Pixels API) Full control Growing brands, ad-heavy stores
Server-side tagging (sGTM) Advanced ✅ Yes + webhook backup Full control High-volume stores, EU compliance

Step 0: Create Your GA4 Property

Every method below requires an active GA4 property. If you don't have one yet, here's how to create it:

  1. Go to analytics.google.com and sign in with your Google account.
  2. Click Start measuring to create a new account.
  3. Enter an account name, then set up your property. Name it after your store, choose your reporting time zone and currency carefully — these can't be changed retroactively without data loss.
  4. When prompted for business objectives, select Get baseline reports for simplicity.
  5. Choose Web as the platform for your data stream, enter your Shopify store URL, and note the Measurement ID (format: G-XXXXXXXXXX). You'll need it in every method below.

One property, one store. If you operate multiple domains (e.g. a .com and a .co.uk), create a separate property for each, all under the same GA4 account.

Method 1: The Google & YouTube App (Recommended for Most Stores)

This is the official, no-code path. It handles the core ecommerce event set — page views, product views, add-to-cart, begin checkout, purchase — without any custom code, and it works inside Shopify's sandboxed checkout.

  1. In your Shopify Admin, go to Online Store → Preferences and scroll to the Google Analytics section. Click Update account if prompted, or search the App Store for Google & YouTube and install it.
  2. Inside the app, click Get started under the "Set up Google Analytics 4" section.
  3. Connect your Google account and select your GA4 property from the dropdown. Click Connect.
  4. Shopify will begin sending ecommerce events to GA4 immediately.

That's it for the connection. But don't close your laptop yet — there are three post-install settings you absolutely must configure (see below).

Method 2: Google Tag Manager + Shopify Custom Pixel

This method gives you full control over which events fire and when. It's the right choice if you're running Google Ads and need Enhanced Conversions, or if you want to track custom interactions like video plays, scroll depth, or size-guide opens.

The key nuance on Shopify: GTM's standard container snippet cannot access the checkout. You must use Shopify's Web Pixels API (Customer Events) for checkout-stage events, then pass the data into your GTM container via a custom pixel.

  1. Create a GTM account and container at tagmanager.google.com.
  2. In Shopify Admin, go to Online Store → Preferences → Customer events. Add a custom pixel and paste your GTM snippet there.
  3. Back in GTM, create a new tag: type Google Analytics: GA4 Configuration, enter your Measurement ID, and set it to fire on All Pages.
  4. Add a second GA4 Event tag for purchase. Set the trigger to a Data Layer event named purchase, and pass the ecommerce object using a Data Layer Variable.
  5. Preview your container using GTM's Preview mode and verify events are firing before publishing.

Critical rule if you use both methods: never load a second GA4 Measurement ID tag via GTM if the Google & YouTube app is already connected. Use the app for the base GA4 configuration and GTM only for additional custom events. Duplicate tags are the most common cause of inflated event counts.

Method 3: Server-Side Tagging (Advanced)

Browser-side tracking has a structural weakness: ad blockers and Safari ITP silently drop a meaningful share of events. Server-side tagging routes your event data through your own server before sending it to GA4, bypassing those blockers entirely.

Providers like Stape and Elevar act as middleware between Shopify's order webhooks and GA4's Measurement Protocol. The setup is more complex — and if your server-side container goes down or is misconfigured, there is no automatic fallback to the browser. This is a powerful option, but not a set-and-forget one.

Unless you're running significant ad spend and have a technical resource available, start with Method 1 and revisit server-side when your data volume justifies it.

Three Post-Install Settings Most Guides Skip

Connecting the app is the beginning, not the end. These three settings can completely change the reliability of your reports.

1. Extend Data Retention to 14 Months

By default, GA4 stores user and event data for only two months. This means any report comparing year-over-year performance will lose data. Go to Admin → Data Settings → Data Retention and change the setting to 14 months. Do this on day one — you cannot recover data that's already been deleted.

2. Enable Google Signals

Google Signals allows GA4 to stitch together cross-device journeys for users signed into Google accounts, improving your audience reporting and remarketing. Go to Admin → Data Settings → Data Collection and toggle on Google Signals. Note that this activates thresholding on reports with small audiences, but the benefit to audience quality almost always outweighs that trade-off.

3. Filter Out Internal Traffic

Every time you or your team browse your own store, those visits pollute your data. Set up an internal traffic filter in GA4 under Admin → Data Streams → Configure tag settings → Define internal traffic using your office IP addresses. Then go to Admin → Data Filters and activate it. This is especially important during launch when you're testing your store constantly.

4. Check Your Pixel Privacy Setting (New in 2026)

Since early 2026, Shopify's pixel setting defaults to Optimized, which can restrict data sharing to specific channels like Google Ads or Meta. If your GA4 is not receiving checkout events, check Shopify Admin → Settings → Customer events and confirm your custom pixel permissions are set correctly for GA4.

Validating Your GA4 Installation

Never assume your tracking is working — verify it. Here's a quick validation workflow:

  • GA4 DebugView: Go to Admin → DebugView in GA4. Open your store in another tab and browse — you should see events streaming in within seconds.
  • Realtime report: Use the Realtime overview report in GA4 to confirm live data is flowing correctly into your property.
  • Google Tag Assistant: Install the Chrome extension and visit your store. It will show which GA4 tags are firing and flag any configuration issues.
  • Check for duplicate purchases: In GA4, go to Reports → Monetization → Ecommerce purchases. If you see the same transaction_id appearing more than once, your purchase event is double-firing — one of the most common Shopify tracking mistakes.

What GA4 Tracks by Default on Shopify — and What It Misses

Shopify's native integration sends a solid baseline of events: page_view, search, view_item, add_to_cart, begin_checkout, and purchase. For many stores, that's enough to run meaningful funnel analysis.

Where the native setup falls short: item-level data inside purchase events is sometimes incomplete, and mid-funnel events can be missed depending on your theme and checkout flow. Without properly configured purchase, add_to_cart, and begin_checkout events, you see traffic but not money — which campaigns drive revenue, where in checkout shoppers drop off, which products generate the most abandoned carts.

If you're running a product-heavy store and want to understand which SKUs are actually converting, this is where GA4's Ecommerce reports — paired with clean product data from your sourcing stack — become genuinely powerful. If you source from Chinese marketplaces like 1688 or Taobao, tools like Piratify handle the product and fulfillment side, but GA4 is what tells you which of those products are actually worth reordering. The two work together.

For a deeper look at keeping your Shopify operations lean and data-driven, see our guide on Shopify store performance tracking essentials.

FAQ

Can I use Google Tag Manager and the Google & YouTube app at the same time?

Yes, but you must be careful. Use the Google & YouTube app as your base GA4 connection, and GTM only for additional custom events — never to fire a second GA4 tag with the same Measurement ID. Running duplicate GA4 tags inflates every event count in your reports.

Why is GA4 showing zero data after I connected the app?

The most common causes are: (1) the wrong GA4 property was connected — double-check the Measurement ID in GA4 Admin matches what Shopify has on file; (2) your store's pixel settings are set to Optimized and are restricting GA4 data; (3) you have an ad blocker active in the browser you used to test. Use GA4's DebugView with a clean browser profile to confirm data is flowing.

Does GA4 track Shopify's checkout and thank-you page?

Yes — when connected via the Google & YouTube app, GA4 receives checkout events including the purchase completion. Shopify's Web Pixels API handles this in a sandboxed way that works even on the thank-you page. If you're using a custom GTM implementation, you need to route checkout events through Shopify's Customer Events (custom pixel) system, not just the standard GTM container snippet.

READY TO SOURCE SMARTER?
Piratify connects your Shopify store directly to China's biggest wholesale marketplaces — 1688, Taobao, Tmall, JD and more — with sourcing and fulfillment built in. Skip the middlemen, find better products, and ship without the hassle.
Arrow right icon
z
z
z
z
i
i
z
z
Start sourcing cheaper today.
Join Piratify and access wholesale prices from China's 6 biggest marketplaces.