Google Analytics
Send visits, product views, carts, checkouts and purchases to a Google Analytics 4 property, after the visitor's analytics consent.
The Google Analytics app loads Google's tag (gtag.js) on every storefront page and sends your store's events to a GA4 property. It needs only your measurement ID.
Set it up
Find your measurement ID
In Google Analytics: Admin, Data streams, your web stream. The measurement ID starts with G-, for example G-AB12CD34EF. Universal Analytics IDs (UA-...) no longer collect data and are refused.
Install and paste it
In the store: Apps, Google Analytics, Install. Paste the ID under Measurement ID and Save. Lowercase letters are fixed for you. Add your measurement ID on the checklist ticks itself.
See a test event
Open your store in another tab and accept analytics cookies if the banner asks. The first event your store sends ticks See a test event on the checklist. In Google Analytics, Reports, Realtime shows the visit within a minute. If you check it some other way, Mark done ticks the step by hand.
A store in Draft sends events too, while you preview it, so you can check the setup before you open.
What it sends
| Store event | GA4 event | With |
|---|---|---|
| Any page opens | page_view | The page's address and title |
| A product page opens | view_item | The product, its price and currency |
| Add to cart | add_to_cart | The product, units added, value |
| Checkout opens | begin_checkout | The cart's items and subtotal |
| The thank-you page after an order | purchase | transaction_id (the order number), value, tax, shipping, items |
Items carry item_id (the product's id), item_name, item_variant, price and quantity. Money is in the currency the visitor shopped in.
Page views go out from the store itself, so moving between pages without a full reload counts each page once. The tag's own automatic page view is off.
Consent
Google's tag waits for analytics consent wherever the store's cookie banner applies. Until then nothing from Google loads. When a visitor accepts on a page, that page's events so far are sent then; earlier pages are not. If a visitor takes consent back, the store stops sending events and tells the tag (analytics_storage denied). See Privacy and cookies.
Related
Apps
Starsell's own apps - Google Analytics, the Meta and TikTok pixels, Morning invoices, Instagram, TikTok and CJ - how to install one, connect it, follow its checklist and uninstall it.
Meta Pixel
Send page views, product views, carts, checkouts and purchases to your Meta pixel for Facebook and Instagram ads, after the visitor's marketing consent.