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.

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:
- Go to Admin (gear icon)
- Click "Create Property"
- Enter property name (your store name)
- Set timezone and currency
- Select business type and objectives
- Create property
Step 2: Get Your Measurement ID
After property creation:
- Go to Admin > Data Streams
- Click "Add stream" > "Web"
- Enter your website URL
- Name the stream
- Copy your Measurement ID (starts with G-)
Step 3: Add GA4 to Shopify
Option A: Shopify's Native Integration
- Go to Online Store > Preferences
- Scroll to Google Analytics
- Paste your Measurement ID
- Save
Option B: Google & YouTube Channel App
- Install "Google & YouTube" from Shopify App Store
- Connect your Google account
- Select your GA4 property
- The app handles integration
Option C: Manual via Theme Code
- Go to Online Store > Themes > Edit code
- Find theme.liquid
- 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:
- Admin > Data Streams
- Click your web stream
- 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:
- In Enhanced Measurement settings
- Click gear icon next to Site Search
- Enter your search parameter (typically "q")
- Save
Testing Your Setup
GA4 DebugView
Real-time debugging:
- Install GA Debugger Chrome extension
- Turn on debugging
- Browse your store
- In GA4, go to Admin > DebugView
- 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:
- Go to Explore
- Click "Free form"
- Add dimensions (product, category, source)
- Add metrics (purchases, revenue, quantity)
- 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:
- Click "Funnel exploration"
- Add steps:
- Step 1: view_item
- Step 2: addtocart
- Step 3: begin_checkout
- Step 4: purchase
- 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:
- In GA4, Admin > Product Links
- Click "Google Ads Links"
- Link your Google Ads account
- 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:
- Admin > Attribution Settings
- Set lookback window (default 30 days)
- Choose attribution model
Privacy and Consent
Consent Mode
For GDPR/CCPA compliance:
- Enable Consent Mode in GA4
- Configure based on user consent
- 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:
- Create GA4 property
- Install via Shopify native integration or Google & YouTube app
- Enable enhanced measurement
- Test e-commerce events
Key reports to use:
- Monetization > Ecommerce purchases
- Monetization > Purchase journey
- Acquisition > Traffic acquisition
- 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
- [1]Set up Google Analytics - Shopify (2025)
- [2]GA4 E-commerce Implementation - Google (2025)
Attribute Team
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.