Launch Offer2 free audits with all 229 checks. No credit card required.Start free audit

GA4 for Shopify: The Complete Setup Guide (2026)

Intermediate

What is the best way to set up GA4 on Shopify?

Three options for GA4 on Shopify in 2026: (1) Shopify's native GA4 integration (via Shopify Admin → Online Store → Preferences → Google Analytics — uses Shopify's built-in Google & YouTube channel app), (2) GTM via Shopify's Custom Pixels (Shopify Admin → Settings → Customer Events → Add custom pixel — the correct approach for full GA4 control), and (3) Third-party GA4 apps (Elevar, Littledata, Analyzify — paid solutions that handle complex Shopify tracking). The recommended approach for most Shopify stores: GTM via Shopify Custom Pixels. Shopify's native integration has well-documented limitations (inconsistent purchase event firing, items array integrity issues) and is not recommended for conversion-accuracy-critical implementations.

Understanding Shopify's checkout architecture

Shopify's checkout is on a separate subdomain or custom domain (checkout.mystore.com or mystore.myshopify.com). The thank-you/order status page is on this checkout domain. This creates a cross-domain tracking challenge: the GA4 tag on your main store domain needs to pass the session context to the checkout domain.

Shopify handles this differently from standard cross-domain:

  • On Shopify Plus: you have full access to checkout.liquid and can add GTM/GA4 directly
  • On standard Shopify plans: checkout pages are controlled by Shopify — you can only add scripts via Shopify's "Additional scripts" section in the checkout settings (being phased out) or via Custom Pixels (the replacement)

Method 1 — Shopify's native GA4 integration

Setup: Shopify Admin → Sales channels → Google → Google Analytics 4 → connect your GA4 property

What it tracks automatically:

  • page_view events
  • view_item events
  • add_to_cart events
  • begin_checkout events
  • purchase events (on order confirmation)

Known limitations:

  • Items array sometimes missing item_id or price on certain Shopify themes
  • Purchase event can fire multiple times (no native deduplication)
  • Limited parameter customisation
  • Consent Mode integration is separate from Shopify's native GA4 setup
  • Not suitable for EU/UK stores without additional Consent Mode configuration

Use this if: Simple store, low traffic, no EU/UK consent requirements, and you need a working implementation quickly. Verify revenue reconciliation (GA4 vs Shopify admin) and check for duplicate transactions before relying on this data.

Method 2 — GTM via Shopify Custom Pixels (recommended)

Shopify Custom Pixels (Settings → Customer Events → Add custom pixel) allow you to add JavaScript that runs on all storefront pages AND the checkout flow, including the order status/thank-you page — without needing Shopify Plus.

Step 1 — Install GTM via a Custom Pixel:

Want to see whether purchase, revenue, or item-level tracking is drifting in your property?

In Shopify Settings → Customer Events → Add custom pixel → Custom pixel:

Step 2 — Use Shopify's pixel events to push to dataLayer:

Step 3 — In GTM: Create a GA4 event tag triggered by the Custom Event purchase from the dataLayer push above.

Preventing duplicate purchases on Shopify

Shopify's order status page can be viewed multiple times (users bookmark it, Shopify sends email confirmations with a link back to it). Without deduplication, every view fires the purchase event again.

Fix — Use Shopify's checkout_completed event instead of page_view on thank-you page:

The analytics.subscribe("checkout_completed", ...) event in Shopify's Custom Pixel API fires only once per order completion — not on subsequent page views of the order status page. This is the correct trigger for the purchase event.

If using Additional Scripts (legacy): Check if the order ID has been pushed to the dataLayer already using sessionStorage, as described in the WordPress guide — the same deduplication pattern applies.

Revenue discrepancy: GA4 vs Shopify

Common causes of GA4 revenue not matching Shopify's actual revenue:

IssueDirectionCause
Refunds not trackedGA4 > ShopifyRefund events not implemented
Draft/test orders trackedGA4 > ShopifyTest orders firing purchase event
Checkout abandonment trackedGA4 > Shopifybegin_checkout counted as a value event
Consent rejectionGA4 < ShopifyEU users who rejected cookies
Currency mismatchGA4 ≠ ShopifyGA4 property currency differs from store currency

Acceptable variance: ±5–10%. Above 10% requires investigation.

Consent Mode V2 for Shopify EU/UK stores

For EU/UK Shopify stores, Consent Mode V2 is required if you run Google Ads. Options:

Shopify's Cookie Banner (basic): Shopify provides a basic cookie consent banner via Shopify Admin → Online Store → Preferences → Cookie banner. It integrates with Shopify's Customer Privacy API but Consent Mode V2 support is limited.

Recommended: Use a dedicated CMP plugin for Shopify (Complianz, Cookiebot, OneTrust Shopify app) that properly implements Consent Mode V2's four parameters via your GTM Custom Pixel setup.

FAQ: GA4 for Shopify: The Complete Setup Guide

What is the first thing to verify when ga4 for shopify: the complete setup guide affects revenue?

Check whether the event fired with the correct transaction ID, revenue value, currency, and item array. Those four fields explain most ecommerce reporting failures.

Should I compare GA4 only to the ecommerce platform total?

No. Use order data, checkout flow behavior, and event payload evidence together. Platform totals alone do not tell you whether the issue is loss, duplication, or attribution drift.

How do I keep this from breaking after the next release?

Build a checkout QA routine that runs after changes to cart, consent, payment, shipping, discounts, or order confirmation logic.

Audit GA4 for Shopify: The Complete Setup Guide before revenue reporting drifts further

Run a free GA4 audit to catch purchase, refund, item-array, and attribution issues before they distort ecommerce decision-making.

These findings come from auditing thousands of GA4 properties. See how your property compares

GA4 Audits Team

GA4 Audits Team

Analytics Engineering

Specialising in GA4 architecture, consent mode implementation, and multi-layer audit frameworks.

Share