EventsService class (accessed via client.events) records what a shopper does on your
storefront — which products they view, add to their cart, or add to their wishlist. These
interactions power the next-likely-item recommendation (type: 'next' in
AI Recommendations): the products a shopper
is most likely to look at next, given where they are in their current session.
The endpoint is publishable-key accessible, so you can call it directly from the browser. It
returns immediately and is processed in the background — sending an event never blocks the page.
Methods
recordEvent
Record a single storefront interaction. Call it as the shopper browses.
Response
202. Recording an event is
fire-and-forget: it returns nothing to read, and a failed write is never surfaced to the shopper.
The call returns { recorded: true } with a 202 Accepted.
Parameters:
Use the same
session_id for every event in a browsing session (generate one per session
and keep it in local storage, the way you would for an anonymous cart). The session path is what
lets Tybrite learn “after this product, shoppers usually look at that one.”How next-likely-item is built from these events
Tybrite groups your events bysession_id into ordered product paths — for example
[TV] → [soundbar] → [HDMI cable]. Across many sessions it counts how often shoppers go from one
product to another and turns those counts into probabilities (e.g. after the TV, the soundbar is
the most common next product). The next recommendation type then returns, for a shopper’s
current product, the items most likely to come next. The model is rebuilt periodically, so it
strengthens as more events accumulate — and until there is enough session data, next gracefully
falls back to “frequently bought together,” then “similar,” then “trending.”
Where these events show up
Product events feed three surfaces (beyond thenext rail):
- the Store Analytics conversion funnel —
viewandadd_to_cartare its first two stages (see Analytics → How these events power Store Analytics for the full picture and thesession_idstitching rule); - “Most viewed products” in the admin Engagement tab;
- the Discovery API (
most-viewed,most-added-to-cart,best-converting) a storefront renders as “Popular now” shelves and PDP “hot” badges — so the events you send here come back as shoppable signals.
session_id as your Analytics beacons so all of the above connect.

