POST /beacon batch is validated against a schema chosen by its event_type field. Events that don’t match their schema are dropped from the batch.
Common fields
These fields are accepted on every event. Server-enriched fields (geo, device, browser, OS) are added automatically. Don’t send them.Unique identifier for the event. Use a ULID or UUID generated client-side. Required for deduplication.
The event discriminator. Must be one of the values listed in Supported event types.
ISO 8601 timestamp of when the event occurred (e.g.,
"2026-06-01T14:30:00Z"). Accepted as either an ISO string or a Date-parseable value; stored in UTC.Anonymized session identifier for the shopper’s visit. Should be stable for the duration of a session and rotate at session expiry.
The token returned by Search, Browse, or Blocks. Required to attribute downstream
product_click, product_view, add_to_cart, block_view, and content_* events back to the originating request."web" or "app". Optional. If omitted, the worker infers it from User-Agent and the X-Requested-With header.Shopify product ID. Required for product-scoped events (see Supported event types).
Type of content:
"article" or "page". Required for content_view, content_click, and content_impression.ID of the merchandising rule that produced the banner. Read it from the banner’s
rule_id field in the Browse response. Optional on banner events.Banner type slug:
"link" for the built-in type, otherwise a custom banner type slug. Optional on banner events.1-indexed position in the result set. Required for
product_click, product_impression, product_hover, product_touch.Server-enriched fields
Don’t set these. The worker fills them in:Supported event types
Engagement events (fired from the storefront):
Request events (typically sent server-side by the platform, not the storefront; included here for completeness):
Storefront integrations should generally only send the engagement events listed in Supported event types. The request events are emitted by the Layers platform itself.
content_* events track engagement with articles and pages returned by blocks that use the related content strategy. Include the block’s attribution_token so clicks and views attribute back to the originating block request.
The banner_* events track engagement with merchandising banners returned on Browse responses. Include the banner’s rule_id (present on each banner in the response) so impressions and clicks attribute back to the merchandising rule that placed it. banner_type, banner_mode, web_position, and mobile_position are optional and enable slicing engagement by banner type, mode, and grid position.
The search, autocomplete, and autocomplete_click events together model the search funnel. Use contextual_data on these events to record how the search was initiated:
- On
autocomplete_click, setcontextual_data.typed_queryto the query the shopper had typed,contextual_data.positionto the 1-indexed position of the suggestion inside the panel, andcontextual_data.selection_sourceto which section of the panel it came from (for example,query_suggestion,product, orcollection). - On
search, setcontextual_data.search_sourceto"autocomplete"when the shopper launched the search by picking a suggestion, or"typed"when the shopper submitted the input directly. This lets you measure the click-through and search-conversion rates of autocomplete separately from typed searches.
device_type (mobile, tablet, desktop, or bot) rather than a raw User-Agent string. Their contextual_data contains only the validated fields from the request’s context parameter (see the context data structure). Layers drops unrecognized keys.
Validation rules
event_id,event_type,timestamp,session_idare required on every event.event_typemust be one of the values in Supported event types. Unknown types are dropped.- Type-specific required fields listed in Common fields and Supported event types must be present; missing them causes the individual event to be dropped (the batch still ingests).
- The batch must contain between 1 and 100 events. Outside that range, the entire request fails with
422.
Next steps
- Payload examples — full request bodies for common scenarios.
- Send events — endpoint reference.