How-to's · Shopify · 3 min read
How to Add Google Analytics to Shopify
Short answer
Create a GA4 property with a web data stream, install Shopify's Google & YouTube sales channel, and connect your GA4 property through it so Shopify adds the Google tag and ecommerce events automatically. Make sure your store isn't password protected, then check GA4's Realtime report to confirm data is arriving.
Shopify's built-in analytics tell you what sold. Google Analytics 4 tells you how people got there and what they did before buying. The two together give you a far clearer view of your store. Setup takes about 20 minutes.
What you need
- A Google account
- A Google Analytics account with a GA4 property and a web data stream for your store's domain
- Shopify's Google & YouTube sales channel
- A store that isn't password protected (Shopify says tracking can't start while private mode is on)
You don't need to connect Google Merchant Center to use GA4, although you might want to later for free product listings.
Step 1: Create a GA4 property
- Go to analytics.google.com and sign in.
- Click Admin, then Create > Property.
- Name it after your store, set your time zone and currency (match your Shopify currency).
- Choose Web as the platform and enter your primary domain.
- Note the Measurement ID / Tag ID, which starts with "G-".
Step 2: Install Google & YouTube
- In Shopify, open the Shopify App Store and search for "Google & YouTube."
- Install it and connect the Google account that owns your GA4 property.
- In the channel's settings, find the Google Analytics section and choose your GA4 property.
Shopify then adds the Google tag to your storefront and checkout and sends standard ecommerce events such as page views, product views, add to cart, begin checkout and purchase.
Shopify's help center also points to Google's own "Set up your Google tag" article for Shopify, so follow it if the channel prompts you to.
Step 3: Check it's working
- Open GA4 and go to Reports > Realtime.
- Visit your store in another browser, view a product and add it to the cart.
- You should see yourself appear along with the events within a minute or two.
For purchase events, place a test order. It can take up to 24-48 hours for standard reports to populate, so don't panic if monetization reports look empty on day one.
Step 4: Useful extras
- Link Google Ads in GA4 Admin if you run ads, so conversions and audiences flow between them.
- Link Search Console to see organic search queries inside GA4.
- Mark key events. GA4 lets you mark events like purchase or sign-up as key events (formerly "conversions").
- Exclude internal traffic by defining your office IP in the data stream settings.
Common mistakes
Double tracking. If someone pasted a GA4 snippet into theme.liquid years ago and you also connect the Google channel, every event counts twice. Search your theme code for "gtag" or "G-" and remove old snippets.
Leaving the password page on. No tracking happens until it's removed.
Wrong currency. If GA4 is set to USD and Shopify sells in EUR, revenue reports will be confusing.
Expecting perfect numbers. GA4 relies on browser tracking, and consent banners and ad blockers reduce what it can see. Shopify's order count will always be more accurate for sales.
What to look at first
Once data is flowing, three reports earn their keep:
- Traffic acquisition: Which channels bring sessions and revenue.
- Landing pages: Which pages start sessions, and how well they convert.
- Funnel exploration: Where people drop off between product view, cart, checkout and purchase.
Use these to decide where to work next. A big drop between cart and checkout points to shipping costs or trust issues. A weak landing page points to copy and layout. Our guides to optimizing landing pages and what counts as a good conversion rate help you interpret what you find, and checking your Google rankings covers the search side.
Frequently asked questions
Do I need to paste code into my Shopify theme for GA4?
No. The recommended method is the Google & YouTube channel, which installs the tag and standard ecommerce events for you.
Why don't GA4 and Shopify numbers match?
They count differently. Ad blockers, consent settings, sessions vs visits and attribution models all cause gaps. Use Shopify for sales totals and GA4 for behavior trends.
Why is GA4 showing no data?
The most common cause is a password-protected store. Shopify notes that Google Analytics can't track events until private mode is turned off.
Sources and further reading
Platform features, prices and policies change. Check the official help pages linked above before you act on a detail that matters to your store.