Shopify Google Analytics 4 Setup Guide: Track Sales Correctly (2026)

Most Shopify stores run on guesswork because their analytics are incomplete. Google Analytics 4 (GA4) shows you where sales come from, which products get added to cart, where shoppers drop off, and what your ads actually return. This guide walks you through a complete Shopify GA4 setup, from creating the property to verifying purchase data, so your reports match what your store really sells.

Shopify Google Analytics 4 setup guide

Introduction:

If you run a Shopify store and cannot answer "which channel made my last 100 orders," you are spending money blind. Google Analytics 4 is the free tool that answers that question, but only when it is connected to Shopify correctly. A default install often misses purchases, double-counts orders, or sends events without revenue data, which makes your Google Ads and marketing decisions unreliable.

This guide covers the full Shopify GA4 setup in the order you should do it: create the property, connect it to your store, track the ecommerce funnel, mark purchases as key events, handle consent, and verify every step with real data.

In short

Connect GA4 + Track ecommerce events + Mark purchase as a key event + Remove duplicate tags + Verify in DebugView = Sales data you can trust

What You'll Achieve With This Setup

After following these steps, your GA4 property will:

Show accurate revenue by channel

Reveal the full ecommerce funnel

Give your Google Ads accurate ROAS data

Support smarter budget decisions

Before You Start: Requirements Checklist

Requirements

Have these ready first

  • Admin access to your Shopify store
  • A Google account with Editor access on Analytics
  • Your store domain, live and on the primary domain
  • Your cookie consent banner details, if you target the EU or UK
  • A test order plan (a real low-value order or a test payment)

1Create the GA4 property and web data stream

  1. Open Google Analytics, go to Admin, then click Create property.
  2. Set the property name, reporting time zone, and currency to match your Shopify store currency. Currency mismatches are a common cause of wrong revenue.
  3. Under Data streams, choose Web, enter your store URL (for example https://yourstore.com), and save.
  4. Copy the Measurement ID (format G-XXXXXXXXXX). You will need it in Step 2.
  5. Under Admin, then Data settings, then Data retention, set event data retention to 14 months so your year-over-year reports work.

2Connect GA4 to Shopify

Use one primary method for ecommerce tracking. Shopify's native connection handles checkout events that theme code cannot reach.

  1. In Shopify admin, install the Google & YouTube app (sales channel) if it is not installed.
  2. Connect your Google account and select the GA4 property you created. Paste the Measurement ID if prompted.
  3. Confirm the connection status shows active. Shopify then sends storefront events (page views, product views, add to cart) and checkout events (checkout started, purchase) to GA4.
  4. For custom events, use Settings, then Customer events, to review or add pixels. Do not add a second GA4 tag on top of this.
Important: If you already have a GA4 tag pasted into theme.liquid from an old setup, remove it after the app connection is confirmed. Running both is the most common reason for double-counted purchases.

3Verify basic tracking in Realtime

  1. Open your store in an incognito window, browse a product page, and add an item to cart.
  2. In GA4, go to Reports, then Realtime. You should see your session and events within about 1 minute.
  3. Confirm that page_view, view_item, and add_to_cart events appear.

For detailed event parameters, open Admin, then DebugView, using the GA Debugger or Google Tag Assistant browser extension to enable debug mode.

4Check the ecommerce event funnel

A correct setup sends these standard GA4 ecommerce events with the right parameters. Check each one in DebugView, not just in reports.

Event Fires when Must include
view_itemProduct page vieweditems, value, currency
add_to_cartItem added to cartitems, value, currency
begin_checkoutCheckout startedvalue, currency, items
purchaseOrder confirmedtransaction_id, value, currency, items, tax, shipping
Check: Every purchase needs a unique transaction_id. If the same ID fires twice, you have a duplicate tag. If value is 0, the event is not reading the order total.

5Add a missing event with theme code (optional)

Use this only if DebugView shows view_item is missing on your theme. Place it in sections/main-product.liquid or a product snippet, and make sure your GA4 tag already loads. The guard prevents errors if GA4 is not loaded.

{%- comment -%} Product view event, only if the connection did not send it {%- endcomment -%} {%- if product -%} <script> window.dataLayer = window.dataLayer || []; if (typeof gtag === 'function') { gtag('event', 'view_item', { currency: '{{ cart.currency.iso_code }}', value: {{ product.price | divided_by: 100.0 }}, items: [{ item_id: '{{ product.selected_or_first_available_variant.sku | default: product.id }}', item_name: '{{ product.title | escape }}', item_brand: '{{ product.vendor | escape }}', item_category: '{{ product.type | escape }}', price: {{ product.price | divided_by: 100.0 }}, quantity: 1 }] }); } </script> {%- endif -%}

Note: Shopify prices are in cents, so the code divides by 100. Test on a multi-currency store, because Shopify Markets may need cart.currency adjustments.

6Mark purchase as a key event

  1. In GA4, go to Admin, then Events.
  2. Find purchase and toggle Mark as key event. Add begin_checkout as a key event too if you want a funnel signal.
  3. Wait 24 to 48 hours, then check Reports, then Monetization, then Ecommerce purchases to confirm revenue is flowing.

Key events are what Google Ads imports for Smart Bidding. Without this step, your ads optimize for the wrong signal.

Common Mistakes to Avoid

  • Running two GA4 tags (theme snippet plus app)
  • Currency set to USD while the store sells in INR
  • Not marking purchase as a key event
  • Including your own team's test orders in reports
  • Ignoring consent mode for EU traffic
  • Judging data in the first 24 hours
Avoid these mistakes →

Troubleshooting: Symptom, Cause, Fix

Symptom Likely cause Fix
No data in RealtimeWrong Measurement ID or store not connectedRe-check the ID in the Google & YouTube app and clear the cache
Purchases doubledTwo GA4 tags firingRemove the theme snippet, keep one method, retest with one order
Purchase value is 0Event not mapped to order totalConfirm the purchase event in DebugView includes value
Revenue much lower than ShopifyAd blockers, consent rejections, split sessionsCompare the same date range and currency; expect a 10 to 30 percent gap
Events missing on mobileTheme script errors or slow loadTest with the browser console open and check the Shopify speed guide

Pro Tips

Get more value from GA4

  • Create a custom report for revenue by product and channel
  • Set up a test order each week to confirm purchases are tracked
  • Use server-side tagging only if ad blockers cause a large gap
  • Document your tracking setup so future theme changes do not break it
  • Review events after every theme or app update
Improve conversions with this data →

FAQ

Create a GA4 property and web data stream to get a Measurement ID that starts with G-. Connect the property to Shopify using the Google & YouTube app, then confirm events appear in GA4 Realtime and DebugView.
Yes. Shopify supports GA4 through the Google & YouTube app and its Customer events system, which send product views, add to cart, checkout, and purchase data.
Connect GA4 so the purchase event fires on the order confirmation step with transaction ID, value, currency, and items. Then mark purchase as a key event under Admin, then Events.
Duplicates usually come from two GA4 tags, such as a theme snippet plus the app connection. Keep one method, remove the extra tag, and confirm one purchase per transaction ID in DebugView.
Ad blockers, cookie rejections, consent banners, and split sessions all reduce GA4 totals. Compare both systems using the same date range and currency, and expect a gap rather than an exact match.
If you sell to visitors in the EEA or UK, use Google Consent Mode v2 with a consent banner so analytics and advertising storage follow each visitor's choice.
Realtime reports show events within minutes. Standard reports can take 24 to 48 hours to fully populate, and ecommerce and attribution reports may take longer to stabilize.
The basic connection takes under an hour with this guide. Hire a developer for custom events, Google Ads or Meta conversion mapping, server-side tagging, or a full audit of duplicate and missing events.

Ready to Build or Improve Your Shopify Store?

Work with expert Shopify developers to grow your eCommerce business faster