Skip to Content
StarsellDocs
Apps

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 eventGA4 eventWith
Any page openspage_viewThe page's address and title
A product page opensview_itemThe product, its price and currency
Add to cartadd_to_cartThe product, units added, value
Checkout opensbegin_checkoutThe cart's items and subtotal
The thank-you page after an orderpurchasetransaction_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.

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.

On this page