Track events
/ store/ v1/ analytics/ events- Idempotency-Key supported
Record what a shopper did on a headless storefront, for the store's conversion funnel: page_view, product_view, add_to_cart, checkout_started, checkout_completed. Send events in batches (up to 50) with anonymous visitor and session IDs. Bots, shoppers who opted out (DNT: 1, Sec-GPC: 1, consent: false) and events older than a day are discarded, not refused. Limited to 300 batches per minute per client address.
Headers
Idempotency-KeystringSend the same key to retry safely: the first answer is replayed for 24 hours.
shop-api-versionYYYY-MMThe version to answer in. Without it, your app’s pinned version, else the newest.
Body
visitor_idstringrequiredA random UUID the storefront keeps per browser (a long-lived first-party cookie or local storage). Never a customer ID, email or anything else that names a person.
session_idstringrequiredA random UUID per visit, renewed after 30 minutes without activity.
eventsarray of objectsrequired1–50 events, oldest first.
consentboolean · or nullThe shopper's answer on the storefront's consent banner, if it has one:
falserecords nothing.DNT: 1andSec-GPC: 1request headers are honoured the same way.landingobject · or nullThe visit's landing page and referrer: send them with the visit's first batch, so its traffic source and campaign are known.
Returns
202 Queued.
Errors
- 401
unauthenticatedMissing or invalid publishable key. - 422
validation_failedInvalid batch. - 429
rate_limitedToo many batches.