Skip to main content
Attribute
Back to Blog
GuideUpdated December 27, 2025

How to Set Up E-commerce Tracking in GA4 for Shopify

Install GA4 via Shopify native integration (Online Store > Preferences) or Google & YouTube app. Enable enhanced measurement. Verify e-commerce events fire: view_item, add_to_cart, begin_checkout, purchase. Test with GA4 DebugView. Shopify auto-sends key events but may miss some like remove_from_cart.

Attribute Team
E-commerce & Shopify Experts
December 27, 2025
6 min read
Set Up E-commerce Tracking - guide article about how to set up e-commerce tracking in ga4 for shopify

Google Analytics 4 tracks e-commerce differently than Universal Analytics. This guide covers setup, event configuration, and getting accurate data from your Shopify store in GA4.

GA4 vs. Universal Analytics

The Key Differences

Universal Analytics (deprecated July 2024):

  • Session-based
  • Pageviews as primary metric
  • E-commerce tracking via goals and transactions

GA4:

  • Event-based
  • Users and engagement as primary
  • E-commerce via specific event names
  • More flexible but more complex

Why GA4 Matters

Google requires GA4. Universal Analytics stopped processing data. You must use GA4 to continue Google Analytics tracking.

Basic GA4 Setup for Shopify

Step 1: Create GA4 Property

In Google Analytics:

  1. Go to Admin (gear icon)
  2. Click "Create Property"
  3. Enter property name (your store name)
  4. Set timezone and currency
  5. Select business type and objectives
  6. Create property

Step 2: Get Your Measurement ID

After property creation:

  1. Go to Admin > Data Streams
  2. Click "Add stream" > "Web"
  3. Enter your website URL
  4. Name the stream
  5. Copy your Measurement ID (starts with G-)

Step 3: Add GA4 to Shopify

Option A: Shopify's Native Integration

  1. Go to Online Store > Preferences
  2. Scroll to Google Analytics
  3. Paste your Measurement ID
  4. Save

Option B: Google & YouTube Channel App

  1. Install "Google & YouTube" from Shopify App Store
  2. Connect your Google account
  3. Select your GA4 property
  4. The app handles integration

Option C: Manual via Theme Code

  1. Go to Online Store > Themes > Edit code
  2. Find theme.liquid
  3. Add GA4 tag in the <head> section:

`html <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXXX'); </script> `

Replace G-XXXXXXXXXX with your Measurement ID.

E-commerce Event Tracking

Required E-commerce Events

GA4 recognizes these e-commerce events:

| Event | Description | When to Fire | |-------|-------------|--------------| | viewitem | Product page view | Product page loads | | addtocart | Item added to cart | Add to cart clicked | | removefromcart | Item removed from cart | Remove from cart | | viewcart | Cart page viewed | Cart page loads | | begincheckout | Checkout started | Checkout begins | | addshippinginfo | Shipping info entered | Shipping step complete | | addpayment_info | Payment info entered | Payment step complete | | purchase | Transaction completed | Order confirmed |

Shopify Native Events

If using Shopify's native integration: Shopify automatically sends:

  • view_item
  • addtocart
  • begin_checkout
  • purchase

What may be missing:

  • removefromcart
  • addshippinginfo
  • addpaymentinfo

Enhanced E-commerce Data

What should be included with events:

`javascript gtag('event', 'purchase', { transactionid: '12345', value: 99.99, currency: 'USD', items: [{ itemid: 'SKU123', item_name: 'Product Name', category: 'Category', quantity: 1, price: 99.99 }] }); `

Setting Up Enhanced Measurement

Enable Enhanced Measurement

In GA4:

  1. Admin > Data Streams
  2. Click your web stream
  3. Toggle on Enhanced Measurement

What this tracks automatically:

  • Page views
  • Scrolls
  • Outbound clicks
  • Site search
  • Video engagement
  • File downloads

Configure Search Tracking

If Shopify search URLs include query parameters:

  1. In Enhanced Measurement settings
  2. Click gear icon next to Site Search
  3. Enter your search parameter (typically "q")
  4. Save

Testing Your Setup

GA4 DebugView

Real-time debugging:

  1. Install GA Debugger Chrome extension
  2. Turn on debugging
  3. Browse your store
  4. In GA4, go to Admin > DebugView
  5. Watch events appear in real-time

Testing Checklist

Verify these events fire:

  • [ ] Page view on homepage
  • [ ] view_item on product page
  • [ ] addtocart when adding to cart
  • [ ] begin_checkout when starting checkout
  • [ ] purchase when completing order

Common Setup Problems

Events not appearing:

  • Check Measurement ID is correct
  • Verify code is in correct location
  • Test with incognito (no ad blockers)

Duplicate events:

  • Multiple tracking codes installed
  • Both Shopify native and manual code

Missing e-commerce data:

  • Enhanced e-commerce not configured
  • Shopify settings not complete

Building E-commerce Reports

Standard Reports

E-commerce Purchases: Reports > Monetization > Ecommerce purchases

Shows:

  • Items viewed
  • Items added to cart
  • Items checked out
  • Items purchased

Purchase Journey: Reports > Monetization > Purchase journey

Shows funnel from view to purchase with drop-off rates.

Creating Custom Reports

For deeper analysis:

  1. Go to Explore
  2. Click "Free form"
  3. Add dimensions (product, category, source)
  4. Add metrics (purchases, revenue, quantity)
  5. Build custom visualizations

Key E-commerce Metrics

Track these in GA4:

  • Purchase conversion rate
  • Average order value
  • Revenue per user
  • Add-to-cart rate
  • Cart abandonment rate

Funnel Analysis

Creating a Purchase Funnel

In Explore:

  1. Click "Funnel exploration"
  2. Add steps:
  • Step 1: view_item
  • Step 2: addtocart
  • Step 3: begin_checkout
  • Step 4: purchase
  1. Analyze drop-off at each step

Funnel Insights

What to look for:

  • Which step has highest drop-off?
  • How does funnel differ by device?
  • Which traffic sources convert best through funnel?

Connecting to Google Ads

Import Conversions

Link GA4 to Google Ads:

  1. In GA4, Admin > Product Links
  2. Click "Google Ads Links"
  3. Link your Google Ads account
  4. Select conversions to import

Benefits:

  • Automated conversion tracking
  • Smart bidding optimization
  • Audience sharing

Key Conversions to Import

Primary:

  • purchase (main conversion)

Secondary:

  • addtocart (micro conversion)
  • begin_checkout (micro conversion)

Attribution in GA4

Default Attribution

GA4 uses data-driven attribution: Multiple touchpoints get credit based on their impact on conversion.

Compared to last-click: More accurate but harder to interpret.

Viewing Attribution Reports

In GA4: Advertising > Attribution > Conversion paths

Shows which channels contribute to conversions.

Setting Attribution Window

Configure:

  1. Admin > Attribution Settings
  2. Set lookback window (default 30 days)
  3. Choose attribution model

Privacy and Consent

Consent Mode

For GDPR/CCPA compliance:

  1. Enable Consent Mode in GA4
  2. Configure based on user consent
  3. GA4 models data for non-consenting users

Cookie-less Future

GA4 is built for:

  • Reduced cookie reliance
  • First-party data focus
  • Machine learning to fill gaps

Common GA4 Mistakes

Mistake 1: Multiple Tracking Codes

Problem: Installing both Shopify native and manual code, causing duplicate data.

Fix: Use one method only. Check for multiple G- IDs in source code.

Mistake 2: Not Enabling E-commerce

Problem: Basic tracking only, missing e-commerce events.

Fix: Enable enhanced measurement. Verify e-commerce events in DebugView.

Mistake 3: Wrong Currency Setting

Problem: Currency mismatch between Shopify and GA4.

Fix: Match GA4 property currency to your Shopify currency.

Mistake 4: Ignoring Filters

Problem: Internal traffic inflating data.

Fix: Admin > Data Settings > Data Filters. Filter internal IP addresses.

Mistake 5: Not Testing Checkout

Problem: Assuming purchase event works without testing.

Fix: Complete a test purchase. Verify in DebugView and Reports.

GA4 vs. Shopify Analytics

When to Use Each

Shopify Analytics:

  • Day-to-day sales tracking
  • Inventory management
  • Customer segmentation
  • Quick performance checks

GA4:

  • Traffic source analysis
  • Funnel visualization
  • Cross-device tracking
  • Google Ads integration
  • Custom explorations

Both: They complement each other. Use Shopify for commerce, GA4 for traffic and marketing analysis.

Reconciling Differences

Numbers will not match exactly:

  • Different attribution models
  • Session vs. event counting
  • Timezone differences
  • Sampling in GA4

Within 5-10% is acceptable.

The Bottom Line

GA4 setup for Shopify is not complicated, but it requires attention to detail.

Essential setup:

  1. Create GA4 property
  2. Install via Shopify native integration or Google & YouTube app
  3. Enable enhanced measurement
  4. Test e-commerce events

Key reports to use:

  1. Monetization > Ecommerce purchases
  2. Monetization > Purchase journey
  3. Acquisition > Traffic acquisition
  4. Custom funnel explorations

Verify these events:

  • view_item
  • addtocart
  • begin_checkout
  • purchase

GA4 is more powerful than Universal Analytics but requires more intentional setup. Take time to verify events fire correctly before relying on data for decisions.

Frequently Asked Questions

How do I add GA4 to Shopify?

Easiest method: Go to Online Store > Preferences, paste your GA4 Measurement ID (starts with G-). Alternative: Install the Google & YouTube channel app which handles integration automatically. Only use one method to avoid duplicate data.

What e-commerce events does Shopify send to GA4?

Shopify native integration automatically sends view_item, add_to_cart, begin_checkout, and purchase events. Some events may be missing like remove_from_cart, add_shipping_info, and add_payment_info depending on your setup.

How do I test if GA4 tracking is working?

Install GA Debugger Chrome extension, enable debugging, browse your store, then check GA4 Admin > DebugView. Events should appear in real-time. Complete a test purchase to verify the full funnel.

Why are my GA4 e-commerce reports empty?

Common causes: wrong Measurement ID, code in wrong location, enhanced e-commerce not configured, or ad blockers during testing. Verify in DebugView first, then check for duplicate tracking codes.

How do I connect GA4 to Google Ads?

In GA4, go to Admin > Product Links > Google Ads Links. Link your Google Ads account and select conversions to import. This enables automated conversion tracking, smart bidding optimization, and audience sharing.

Sources & References

Written by

Attribute Team

E-commerce & Shopify Experts

The Attribute team combines decades of e-commerce experience, having helped scale stores to $20M+ in revenue. We build the Shopify apps we wish we had as merchants.

11+ years Shopify experience$20M+ in merchant revenue scaledFormer Shopify Solutions ExpertsActive Shopify Plus ecosystem partners