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:
| Issue | Direction | Cause |
|---|---|---|
| Refunds not tracked | GA4 > Shopify | Refund events not implemented |
| Draft/test orders tracked | GA4 > Shopify | Test orders firing purchase event |
| Checkout abandonment tracked | GA4 > Shopify | begin_checkout counted as a value event |
| Consent rejection | GA4 < Shopify | EU users who rejected cookies |
| Currency mismatch | GA4 ≠ Shopify | GA4 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?
Should I compare GA4 only to the ecommerce platform total?
How do I keep this from breaking after the next release?
Related guides for GA4 for Shopify: The Complete Setup Guide
Shopify GA4 Setup: Web Pixel vs theme.liquid in 2026
The 2026 best practice for Shopify GA4 is Web Pixel via Customer Events API — Shopify's sandboxed pixel system that runs GA4 in isolation, supports the Customer Privacy API for consent, fires standard e-commerce events automatically, and works on all Shopify plans (including Basic)…
Item Array Integrity: What Stops Items Reporting in GA4 (2026)
Items fail to appear in GA4 e-commerce reports when the items array is missing, malformed, or inconsistent across the funnel. Eight common bugs: (1) missing item_id (the only required field — items without it are dropped), (2) item_id mismatched between view_item and purchase (same product reports as different items)…
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.