How to Set Up GA4 for Shopify: Complete 2026 Guide
Set up Google Analytics 4 on Shopify correctly. Covers native integration, GTM setup, enhanced ecommerce events, and common Shopify GA4 mistakes.
Shopify has a native GA4 integration, but it is limited. Here is how to set up GA4 properly on Shopify, including the ecommerce events most stores miss.
Option 1: Shopify Native Integration (Basic)
Shopify has a built-in Google Analytics channel:
- Shopify Admin > Online Store > Preferences
- Or install the "Google & YouTube" app from the Shopify App Store
- Connect your Google account
- Select your GA4 property
What the native integration tracks:
- `page_view` on all pages
- `view_item` on product pages
- `add_to_cart`
- `begin_checkout`
- `purchase` with revenue data
What it misses:
- `view_item_list` on collection pages
- `remove_from_cart`
- `add_shipping_info` and `add_payment_info` (checkout steps)
- `search` on site search
- Custom events (newsletter signup, account creation)
Verdict: Acceptable for small stores. Insufficient for serious ecommerce analytics.
Option 2: GTM + Custom DataLayer (Recommended)
For complete tracking, use Google Tag Manager with a custom dataLayer:
Step 1: Add GTM to Shopify
Add the GTM container snippet to your Shopify theme:
- Online Store > Themes > Edit code
- In `theme.liquid`, add the GTM `<head>` snippet right after `<head>`
- Add the GTM `<body>` snippet right after `<body>`
For Shopify checkout (Plus only), add GTM to checkout settings. For non-Plus stores, use the Additional Scripts in Settings > Checkout.
Step 2: Push Ecommerce Events to DataLayer
Add to your theme's product template:
`javascript
`
Add to your collection template:
`javascript
`
Step 3: Track Purchase on Thank-You Page
In Shopify Settings > Checkout > Additional scripts:
`javascript
{% if first_time_accessed %}
{% endif %}
`
The {% if first_time_accessed %} guard prevents duplicate purchase tracking on page refreshes.
Step 4: Configure GTM Tags
In GTM, create a GA4 Event tag for each ecommerce event:
- Trigger: Custom Event = view_item, add_to_cart, purchase, etc.
- Tag: GA4 Event with "Send Ecommerce data" enabled
Common Shopify GA4 Mistakes
1. Both native and GTM tracking active. This double-counts every event. Use one or the other.
2. Shopify Liquid price format. Shopify prices are in cents (e.g., 2999 = $29.99). Always divide by 100: {{ product.price | divided_by: 100.0 }}
3. Checkout tracking on non-Plus stores. Shopify restricts checkout page customization to Plus plans. Non-Plus stores can only track on the order confirmation page, missing begin_checkout, add_shipping_info, and add_payment_info.
4. Missing cross-domain between store and checkout. Shopify checkout often runs on checkout.shopify.com. Without cross-domain tracking, the checkout is treated as a new session from a referral source.
Not sure if your Shopify tracking is complete? Audit your GA4 setup →
Check your GA4 implementation
Run a free AI-powered audit to see how your tracking stacks up.
Start Free Audit