Skip to content

Track events

POST/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-Keystring

    Send the same key to retry safely: the first answer is replayed for 24 hours.

  • shop-api-versionYYYY-MM

    The version to answer in. Without it, your app’s pinned version, else the newest.

Body

  • visitor_idstringrequired

    A 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_idstringrequired

    A random UUID per visit, renewed after 30 minutes without activity.

  • eventsarray of objectsrequired

    1–50 events, oldest first.

  • consentboolean · or null

    The shopper's answer on the storefront's consent banner, if it has one: false records nothing. DNT: 1 and Sec-GPC: 1 request headers are honoured the same way.

  • landingobject · or null

    The 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

  • 401unauthenticatedMissing or invalid publishable key.
  • 422validation_failedInvalid batch.
  • 429rate_limitedToo many batches.