/apps/live-view/* to the app’s internal proxy routes. Requests arrive from
Shopify HMAC-signed — the signature covers the query parameters, including
the shop domain. Nothing is trusted before signature verification.
There are exactly two endpoints:
Rate limits use a fixed in-memory window keyed on the signature-verified
shop domain — never on client-controlled headers. All responses are sent
with
Cache-Control: no-store.
POST /apps/live-view/track
Ingests a batch of tracker events.- Query:
shop(the store’smyshopify.comdomain, format-validated before authentication). - Body: JSON, maximum 64 KB, of the form
{ "events": [ ... ] }with at most 25 events ingested per batch. A legacy single-event payload shape is also accepted for compatibility. - Response:
{ "accepted": <n> }— the number of events that passed validation and were recorded.
Event fields
Every event carriessid (the anonymous session UUID) and product identity:
pid (numeric product id) or handle (product slug, lowercase, up to 120
characters). Validation is strict:
Handle-only events resolve against the product cache per batch. Malformed
events are dropped silently — the rest of the batch still ingests and the
request never fails the storefront.
A view event is only recorded once per shop + session + product inside the
configured dedupe window (default 30 minutes). Heartbeats refresh presence
instead of creating events.
GET /apps/live-view/stats
Returns the live count the counter block renders.- Query:
shopplus exactly one product identifier —productId(1–24 digits) orhandle(slug). Anything else is a 400. - Response:
countis the number of distinct sessions with a heartbeat inside the presence window (activeWindowSeconds, default 60 s).visibleisfalse— and the widget hides itself — when tracking is disabled for the shop, the product cannot be resolved, the product’s counter is individually disabled, orcountis below the minimum-views threshold. The endpoint never fabricates a count.
Authentication
- Shop format check (pre-auth): the
shopparameter must look like a validmyshopify.comdomain, or the request is rejected with 400 before any signature work. - Proxy signature verification: Shopify’s HMAC signature over the query parameters is verified by the app library. Missing or tampered signatures are rejected with 400/401.
- Installation check: the verified shop must have an installed session in the app; otherwise 403.
- Rate limit: per verified shop, per the table above; over-limit requests get 429.