Analytics 9 min read

Shopify Google Analytics 4 Integration: Complete Setup Guide (2025)

Set up Google Analytics 4 on your Shopify store. Track ecommerce events, configure enhanced measurement, and build custom reports for data-driven decisions.

Quick Answers

How do I add Google Analytics to Shopify?

Use one of three common paths—add a Google tag ID in Shopify settings (basic), implement GA4 via Google Tag Manager (flexible), or use a GA4 app that helps map ecommerce events. After setup, validate events in GA4 DebugView before trusting reports.

Does Shopify work with GA4?

Yes. Shopify stores can be measured in GA4, but accuracy depends on how you implement tracking (native tag vs GTM vs app) and whether recommended ecommerce events are sent with correct parameters.

Google Analytics 4 provides essential insights for growing your Shopify store. This guide covers complete setup, ecommerce tracking, and reporting best practices.

Shopify
integrates with
Google Analytics
Analytics
TOP PICK

Google Analytics 4

Analytics Integration for Shopify
4.5
10 reviews
Price
Free to install
Last Updated
2025-12-21

2025 Snapshot

Data pointValue
Shopify App Store rating4.5/5 (10 reviews, checked Dec 2025)
App pricing modelFree to install (see listing)
IDs you’ll work withGA4 Measurement ID (G-...) and/or GTM Container ID (GTM-...)
Best practice in 2025Validate events in DebugView before relying on reports

Understanding GA4 for Ecommerce

GA4 (Google Analytics 4) replaced Universal Analytics in July 2023. Key differences:

AspectUniversal AnalyticsGA4
Data modelSessions-basedEvents-based
Ecommerce trackingEnhanced EcommerceGA4 Ecommerce events
User identityClient ID onlyClient ID + User ID
Machine learningLimitedBuilt-in predictions
PrivacyCookie-dependentPrivacy-centric design

Why GA4 matters:

  • Only analytics option from Google going forward
  • Better cross-device tracking
  • Predictive metrics (purchase probability)
  • Improved BigQuery integration
  • Built-in consent mode support

Basic Setup: Shopify Native Integration

Step 1: Create GA4 Property

  1. Go to analytics.google.com
  2. Click Admin (gear icon)
  3. Click Create Property
  4. Enter property name (your store name)
  5. Select country and currency
  6. Choose Web as platform
  7. Enter your Shopify domain
  8. Copy the Measurement ID (G-XXXXXXXXXX)

Step 2: Add to Shopify

  1. In Shopify Admin, go to Online Store > Preferences
  2. Scroll to Google Analytics
  3. Paste your GA4 Measurement ID
  4. Click Save
Data Flow
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e0f2fe', 'primaryTextColor': '#0369a1', 'primaryBorderColor': '#0369a1', 'lineColor': '#64748b', 'secondaryColor': '#f0fdf4', 'tertiaryColor': '#fef3c7'}}}%% graph LR A[Shopify Store] -->|Events & Pageviews| B[Shopify] A -->|Transactions| B B -->|Attribution Data| C[Google Analytics] C -->|Insights| D[Dashboard] D -->|Optimization| A
Real-time sync Scheduled sync

Step 3: Verify Installation

  1. Go to GA4 property
  2. Click Reports > Realtime
  3. Open your Shopify store in another tab
  4. Confirm pageviews appear in real-time report

Ecommerce Events Tracked Automatically

Shopify’s native integration tracks these GA4 events:

EventTriggerData Included
page_viewEvery page loadPage title, URL
view_itemProduct page viewProduct ID, name, price, category
view_item_listCollection page viewList of products
add_to_cartAdd to cart clickProduct details, quantity
remove_from_cartRemove from cartProduct details
begin_checkoutCheckout initiationCart contents, value
add_shipping_infoShipping selectionShipping method, value
add_payment_infoPayment entryPayment type
purchaseOrder completionTransaction ID, revenue, products

Purchase Event Data

The purchase event includes:

{
  transaction_id: "1234",
  value: 99.99,
  currency: "USD",
  tax: 8.99,
  shipping: 5.99,
  items: [
    {
      item_id: "SKU123",
      item_name: "Product Name",
      price: 49.99,
      quantity: 2,
      item_category: "Category"
    }
  ]
}

Advanced Setup: Google Tag Manager

For more control, use Google Tag Manager:

Why Use GTM?

  • Custom event tracking
  • Third-party tag management
  • A/B testing integration
  • Advanced triggers and variables
  • Version control for tags

GTM Setup for Shopify

Step 1: Create GTM Container

  1. Go to tagmanager.google.com
  2. Create new container
  3. Select Web as target platform
  4. Copy container ID (GTM-XXXXXXX)

Step 2: Install GTM on Shopify

In theme.liquid (head section):

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->

In theme.liquid (after opening body tag):

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Step 3: Create GA4 Configuration Tag

  1. In GTM, go to Tags > New
  2. Choose Google Analytics: GA4 Configuration
  3. Enter Measurement ID
  4. Trigger: All Pages
  5. Save and publish

Enhanced Tracking Options

Customer Lifetime Value Tracking

Track user ID for cross-device analytics:

// Add to theme.liquid when customer is logged in
{% if customer %}
<script>
  window.dataLayer = window.dataLayer || [];
  dataLayer.push({
    'user_id': '{{ customer.id }}',
    'customer_email_hash': '{{ customer.email | sha256 }}'
  });
</script>
{% endif %}

Custom Events

Track additional interactions:

// Newsletter signup
document.querySelector('.newsletter-form').addEventListener('submit', function() {
  dataLayer.push({
    'event': 'newsletter_signup',
    'form_location': 'footer'
  });
});

// Product quick view
document.querySelectorAll('.quick-view-btn').forEach(function(btn) {
  btn.addEventListener('click', function() {
    dataLayer.push({
      'event': 'quick_view',
      'item_id': this.dataset.productId
    });
  });
});

Scroll Depth Tracking

Enable in GTM:

  1. Go to Variables > Built-in Variables
  2. Enable Scroll Depth variables
  3. Create scroll trigger (25%, 50%, 75%, 100%)
  4. Create GA4 event tag for scroll tracking

GA4 Reports for Ecommerce

Essential Reports to Monitor

1. Ecommerce Purchases Report

Location: Reports > Monetization > Ecommerce purchases

Key metrics:

  • Items viewed
  • Items added to cart
  • Items purchased
  • Item revenue

2. Checkout Journey Report

Location: Reports > Monetization > Checkout journey

Shows funnel:

Sessions with cart
    ↓ (conversion rate)
Sessions with checkout
    ↓ (conversion rate)
Sessions with purchase

3. Purchase Journey Report

Location: Explore > Purchase journey template

Custom funnel analysis:

  • Product view → Add to cart
  • Add to cart → Checkout
  • Checkout → Purchase

Custom Explorations

Create custom reports in Explore:

Revenue by Traffic Source:

Dimensions: Session source/medium
Metrics: Total revenue, Transactions, Average order value

Product Performance:

Dimensions: Item name, Item category
Metrics: Views, Add to carts, Purchases, Revenue

Customer Acquisition:

Dimensions: First user source
Metrics: New users, Transactions, User lifetime value

Conversion Tracking

Setting Up Conversions

  1. Go to Admin > Events
  2. Find the purchase event
  3. Toggle Mark as conversion

Recommended conversions:

  • purchase (automatic)
  • add_to_cart
  • begin_checkout
  • newsletter_signup (custom)
  • contact_form_submit (custom)

Link GA4 with Google Ads:

  1. Go to Admin > Google Ads Links
  2. Click Link
  3. Select Google Ads account
  4. Enable auto-tagging
  5. Import conversions to Google Ads

Data Quality Best Practices

Exclude Internal Traffic

Filter out your team’s visits:

  1. Go to Admin > Data Streams
  2. Click your stream
  3. Go to Configure tag settings
  4. Define internal traffic (by IP)
  5. Create data filter to exclude

Cross-Domain Tracking

If using multiple domains (e.g., checkout on subdomain):

  1. Go to Data Stream settings
  2. Configure cross-domain measurement
  3. Add all domains to the list

For GDPR compliance:

// Default denied state
gtag('consent', 'default', {
  'analytics_storage': 'denied',
  'ad_storage': 'denied'
});

// Update when user consents
function grantConsent() {
  gtag('consent', 'update', {
    'analytics_storage': 'granted',
    'ad_storage': 'granted'
  });
}

Third-Party Apps for Enhanced Tracking

AppFeaturesPrice
LittledataAccurate GA4 tracking, server-side$99/mo+
ElevarData layer, server-side GTM$150/mo+
AnalyzifyEasy GA4 setup, compliance$49/mo+

When to Use Third-Party Apps

Consider apps when you need:

  • Server-side tracking (ad blocker bypass)
  • Accurate attribution across devices
  • Enhanced data layer
  • Compliance automation
  • Marketing platform integrations

Troubleshooting Common Issues

Events Not Tracking

Possible causes:

  • Measurement ID incorrect
  • Ad blocker interference
  • Consent not granted
  • Script loading errors

Solutions:

  1. Verify Measurement ID matches GA4 property
  2. Test in incognito without extensions
  3. Check browser console for errors
  4. Use GA4 DebugView

Purchase Revenue Missing

Possible causes:

  • Order confirmation page issues
  • Currency mismatches
  • Checkout redirect problems

Solutions:

  1. Check order confirmation page loads tracking
  2. Verify currency matches GA4 settings
  3. Test complete checkout flow
  4. Review purchase event in DebugView

Duplicate Events

Possible causes:

  • Multiple tracking codes installed
  • GTM and native both active
  • Theme code duplicated

Solutions:

  1. Audit all tracking installations
  2. Use only one method (native OR GTM)
  3. Check for duplicate scripts in theme

Privacy and Compliance

GDPR Compliance

  • Implement consent management platform (CMP)
  • Use GA4 consent mode
  • Configure data retention settings
  • Enable IP anonymization

Data Retention Settings

  1. Go to Admin > Data Settings > Data Retention
  2. Set event data retention (2 months to 14 months)
  3. Enable reset on new activity

Next Steps

After setting up GA4:

  1. Configure conversions - Mark purchase and key events
  2. Build dashboards - Create custom explorations
  3. Link Google Ads - Enable conversion import
  4. Set up alerts - Monitor traffic anomalies
  5. Train your team - Ensure everyone can access insights

Shopify + Google Analytics implementation checklist (2025)

This section adds practical “make it stable” steps you can use after you install the app/connector. It’s intentionally lightweight: the goal is fewer sync surprises, cleaner reporting, and easier troubleshooting.

1) Quick setup checklist

  • Permissions first: grant only the scopes you need (orders/customers/products as required) and document who owns the admin credentials.
  • Data mapping: confirm how email, phone, currency, and SKU are mapped between Shopify and Google Analytics.
  • Historical import: decide how far back to import orders/customers (avoid importing years of data if you don’t need it).
  • Deduplication rules: pick one unique identifier per object (usually email for customers, order ID for orders) to prevent doubles.
  • Alerts: set a lightweight alert path (email/Slack) for failed syncs, auth expiry, and API rate limits.

2) Data you should verify after connecting

Most integration issues show up in the first hour if you test the right things. Use the table below as a QA checklist (create a test order if needed).

Data objectWhat to checkWhy it matters
CustomersEmail/phone format, marketing consent fields, duplicatesPrevents double messaging and broken segmentation
OrdersOrder total, tax, discount, shipping, currencyKeeps revenue reporting and automation triggers accurate
Line itemsSKU, variant ID, quantity, refunds/returns behaviorAvoids inventory and attribution mismatches
FulfillmentStatus changes + timestamps, tracking numbers, carrier fieldsDrives customer notifications and post-purchase flows
CatalogProduct titles, handles, images, collections/tagsEnsures personalization and reporting match your storefront

3) Automation ideas for Analytics

  • UTM discipline: enforce UTM tagging so Google Analytics attribution remains comparable across channels.
  • Server-side events: use webhooks (when available) to improve reliability vs. browser-only tracking.
  • Consent handling: ensure analytics respects user consent (especially in EU/UK) to avoid data skew.
  • Product-level analysis: standardize SKU/product IDs so Google Analytics reporting aligns with your catalog.
  • QA dashboards: monitor conversion rate, AOV, and returning customer rate weekly for drift.

API sanity check (Shopify Admin API)

If your integration UI says “connected” but data isn’t flowing, a quick API call helps confirm whether the store is accessible and returning the objects you expect.

# List the 5 most recent orders (GraphQL)
curl -X POST "https://your-store.myshopify.com/admin/api/2025-01/graphql.json" \
  -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"query\":\"{ orders(first: 5, sortKey: CREATED_AT, reverse: true) { edges { node { id name createdAt totalPriceSet { shopMoney { amount currencyCode } } customer { email } } } } }\"}"

Tip: keep tokens/keys in environment variables, and test in a staging store/site before rolling changes to production.

4) KPIs to monitor (so you catch problems early)

  • Sync freshness: how long it takes for a new order/customer event to appear in Google Analytics.
  • Error rate: failed syncs per day (and which object types fail most).
  • Duplicates: number of merged/duplicate contacts or orders created by mapping mistakes.
  • Revenue parity: weekly spot-check that Shopify totals match downstream reporting (especially after refunds).
  • Attribution sanity: confirm that key events (purchase, refund, subscription) are tracked consistently.

5) A simple 30-day optimization plan

  1. Week 1: connect + map fields, then validate with 5–10 real orders/customers.
  2. Week 2: enable 1–2 automations and measure baseline KPIs (conversion, AOV, repeat rate).
  3. Week 3: tighten segmentation/rules (exclude recent buyers, add VIP thresholds, handle edge cases).
  4. Week 4: document the setup, create an “owner” checklist, and set a recurring monthly audit.

Related integration guides

Sources

Analytics Platform Comparison

Compare key features across popular analytics solutions

FeatureGlew.ioLifetimelyLittledataTriple Whale
Attribution modelHow credit is assignedLast-touchFirst-touchGA4 enhancedMulti-touch
Server-side trackingBypasses ad blockersNoNoYesYes
Profit trackingTrue P&L visibilityYesYesNoYes
LTV analysisCustomer lifetime valueBasicAdvancedVia GA4Yes
Creative analyticsAd creative performanceNoNoNoYes
Free tierAvailable without paymentNoNoNoLimited

Data based on publicly available information as of February 2026. Features and pricing may vary.