Skip to main content
Shopify guide

GA4 for Shopify Stores

By ยท Updated ยท 7 min read

How GA4 Connects to Shopify

Shopify has a native Google & YouTube channel app that pushes a GA4 property ID into the storefront and sends basic ecommerce events automatically. This covers page views, session starts, and โ€” on Shopify Plus โ€” a server-side purchase event fired from the order confirmation webhook. Standard Shopify plans fire the purchase event from the client-side thank-you page, which means ad blockers and browser privacy features can suppress it.

The critical limitation: Shopify's native integration does not give you control over the data layer. You cannot rename events, add custom parameters, or restructure the event schema without writing custom code in the theme or using a third-party tag management solution. Operators who want GA4's full ecommerce event model โ€” add_to_cart, begin_checkout, add_payment_info, purchase with item-level detail โ€” need to go beyond the native toggle.

The Checkout Tracking Gap on Non-Plus Plans

Shopify restricts theme customization inside the native checkout flow to Shopify Plus merchants. Standard and Advanced plan stores cannot inject Google Tag Manager (GTM) snippets or custom JavaScript into the /checkout pages. This means GA4 loses visibility into steps two through four of the funnel: the shipping address, delivery method, and payment steps all go untracked in GA4's funnel exploration reports.

The order status page (post-purchase) is accessible to all plans via the Additional Scripts field in Settings > Checkout, but that field is deprecated on newer stores in favor of checkout extensibility. Shopify's checkout extensibility blocks third-party JavaScript by design, which means even Shopify Plus merchants on the new checkout must use Shopify's own Web Pixels API to fire GA4 events from inside checkout steps.

The practical workaround for non-Plus stores: measure a three-step funnel โ€” session landing, cart page, purchase โ€” and accept the checkout middle as a black box. Pair this with Shopify's own conversion data in the Analytics dashboard to triangulate funnel health.

Google Tag Manager on Shopify: Setup and Constraints

Adding GTM to Shopify requires pasting the container snippet into theme.liquid (head and body sections) and separately into the order status page via Additional Scripts or a checkout extension pixel. The theme.liquid edit covers all storefront pages. Without a corresponding GTM snippet on the checkout and order status pages, GTM has no visibility into post-cart behavior for non-Plus stores.

Once GTM is installed on the storefront, operators use Shopify's built-in data layer object โ€” window.ShopifyAnalytics and the ecommerce-specific window.dataLayer pushes โ€” to pass product and transaction data into GA4 tags. Shopify does not maintain a fully standardized GTM data layer by default; the data layer events available depend on the theme version. Dawn theme and other Online Store 2.0 themes push dataLayer events for product views and cart updates, but item arrays do not always match GA4's required item schema exactly, requiring transformation via GTM's variable layer.

Third-Party Apps That Fill the Gaps

Several Shopify apps exist specifically to bridge GA4 tracking gaps without requiring theme code edits. Elevar is the most widely adopted in the eight-figure merchant segment; it installs a server-side data layer, maps Shopify's order webhooks to GA4's purchase event schema, and handles deduplication between client and server hits. Littledata takes a similar approach, using a server-side connector to send purchase events directly from Shopify's backend to GA4's Measurement Protocol, bypassing the browser entirely.

These apps solve three concrete problems: (1) purchase event deduplication when both a browser tag and a server webhook fire for the same order, (2) enriched item-level parameters like variant SKU, product type, and collection that Shopify's native integration omits, and (3) improved match rates for conversion events sent to Google Ads via the GA4 linked conversion import. The tradeoff is additional monthly cost and a dependency on the app vendor's data mapping staying current with Shopify's API changes.

For operators not ready to pay for a dedicated analytics app, a free middle path exists: install GTM, use a community-maintained Shopify GTM data layer snippet (several are published on GitHub), and configure GA4 event tags manually. This requires developer time upfront but has no recurring cost and gives full control over the event schema.

Key GA4 Configuration Steps Specific to Shopify

First, exclude the Shopify admin and checkout subdomains from GA4 referral exclusions. Go to GA4 > Admin > Data Streams > your stream > Configure tag settings > List unwanted referrals and add pay.shopify.com and checkout.shopify.com. Without this, checkout redirects register as referral sessions, inflating traffic sources and breaking attribution for the purchase event.

Second, enable Enhanced Measurement in the GA4 data stream but disable the Forms interaction trigger. Shopify's add-to-cart and search forms trigger phantom form_submit events that pollute event counts and skew engagement metrics. Third, create a GA4 conversion event for the purchase event specifically, and import it into Google Ads rather than using the Google Ads conversion tag in parallel โ€” running both simultaneously causes double-counting in ROAS reporting.

Fourth, set the data retention period to 14 months (the maximum) immediately after property creation. GA4 defaults to two months, and Shopify merchants doing year-over-year funnel comparisons will lose data if they miss this setting in the first weeks.

Actionable Priorities for Shopify Operators

Start by auditing what your current setup actually tracks. Place a test order, then check GA4's DebugView in real time to confirm a purchase event fires with item-level data (item_id, item_name, price, quantity). If the purchase event appears but items array is empty, your integration sends revenue but not product-level data โ€” a critical gap for any merchandising analysis.

If you are on Shopify Plus, implement GTM via checkout extensibility Web Pixels or use Elevar's server-side layer to get full funnel visibility. If you are on a standard plan, accept the checkout black box, invest in server-side purchase tracking for accuracy, and build your GA4 analysis around the metrics you can trust: sessions, cart views, and confirmed purchases with correct revenue figures. Accurate data on three funnel stages beats incomplete data on five.

Frequently asked questions

Does Shopify's native GA4 integration track ecommerce events automatically?

Shopify's native Google & YouTube channel app sends page views and a purchase event automatically. It does not send add_to_cart, begin_checkout, or add_payment_info events by default, and the item-level parameters in the purchase event are limited. Full ecommerce event coverage requires GTM, a dedicated analytics app like Elevar or Littledata, or custom theme code.

Why does GA4 show referral traffic from pay.shopify.com?

Shopify routes checkout through pay.shopify.com, which GA4 treats as an external referral domain when a session resumes on the order confirmation page. Fix this by adding pay.shopify.com and checkout.shopify.com to GA4's unwanted referrals list under the data stream's tag settings. Without this exclusion, a large share of purchases will be misattributed to Shopify as a referral source.

Can non-Shopify-Plus stores track the checkout funnel in GA4?

No. Shopify blocks third-party JavaScript in the native checkout on non-Plus plans, so GA4 cannot see shipping, delivery, or payment steps. Non-Plus operators can track the cart page and the post-purchase order confirmation page, but the steps in between are inaccessible. The practical approach is to treat the checkout as a single conversion step and focus optimization on cart-page and post-purchase data.

What causes duplicate purchase events in GA4 for Shopify stores?

Duplication occurs when both a client-side GTM tag and a server-side connector (from an app like Elevar or Littledata) fire a purchase event for the same order. Fix it by using GA4's transaction_id deduplication โ€” GA4 automatically discards a second purchase event that carries an identical transaction_id within a session, provided you pass the Shopify order ID as the transaction_id in both hits.

Is Google Tag Manager required to use GA4 on Shopify?

No. You can add GA4's gtag.js snippet directly to theme.liquid and fire a purchase event via the Additional Scripts field. GTM is not required but gives significantly more control: you can add custom event parameters, manage multiple tags from one interface, and avoid theme edits for future changes. For stores tracking more than basic page views and purchases, GTM is the more maintainable path.

MG
Written by

Matt is the founder of RunOctopus. He built All Angles Creatures from zero to page-1 rankings in reptile feeder insects in under 60 days using exactly this method โ€” turning a hard, entrenched niche into RunOctopus's proof store for programmatic SEO and AI search citation.

Connect on LinkedIn →

See what Otto would build for your store

Free architecture preview. No card required. Five minutes.

Generate Preview →