How to add Google Analytics 4 to Shopify
Connect GA4 to your Shopify store with the Google & YouTube app, which also sends purchases and other store events. Then check them in GA4's Realtime report.
The recommended way to add Google Analytics 4 to Shopify is the free Google & YouTube app from Shopify: install it, connect your Google account, and choose your GA4 property. It adds the tag and sends store events like add-to-cart and purchases, so you don't need to edit your theme.
Connect GA4
In Shopify admin, install the Google & YouTube app from the Shopify App Store.
Open the app and connect the Google account that owns your GA4 property.
In the app's settings, connect Google Analytics and choose your GA4 property (or create one).
Don't add the tag twice
If your theme or an older app already has a GA4 tag, remove it after connecting the app, or visits and purchases are counted twice. Check by searching your theme code (Online Store → Themes → Edit code) for gtag.
Purchases
The app sends GA4's ecommerce events, including purchase with the order value, so GA4 shows revenue by source. Mark purchase as a key event if it isn't already. Key events.
Check it works
Visit your store in a private window and look at GA4's Realtime overview. A test order shows up as a purchase event. More ways to check.
Related
Last updated
Lovable, Bolt, v0
Add GA4 to an app built with Lovable or another AI app builder: ask the builder's chat with a precise prompt, or paste the Google tag into index.html yourself.
Squarespace
Add GA4 to a Squarespace site by pasting your G- Measurement ID into Squarespace's Google Analytics setting, or the full tag with code injection.