request_id.
The basic request
See the endpoint reference for every parameter.
The response
name and metadata. Keep the request_id: send it with the clicks and purchases that follow. See Credit events to recommendations.
Common placements
Create one context per placement, even if two placements look similar today. It lets you tune, measure and test each one separately. See Launch a placement.
New and anonymous visitors
Recommendations work before you know anything about someone:- No history: the context falls back to popular, trending and fresh items, and to content similarity when there is an
item_idor basket seed. - Anonymous visitors: send a stable
anonymous_idor a session-scopeduser_id. When the visitor signs in, link the two identities so their earlier behaviour carries over. See Identity. - Brand new catalogue: “more like this” works from item descriptions alone, before any events exist.
Several rails on one page
A page with several rails should ask for them in one request. The visitor’s history is read once for the page, identical sets are computed once, and each rail still has its ownrequest_id.
- Up to eight sets per request; the SDKs split larger pages for you.
- Each set is billed as one recommendation request. Identical sets in one batch count once.
- A failed set reports its own
statusanderror; the others still return. - Use a stable
request_idwhen retrying the same batch body so the service can reuse that batch. Do not reuse it for a different request. SDK calls split into several batches use additional request IDs; repeating the whole multi-batch call is not a guarantee that every chunk will be reused.
Paged and endless feeds
- Next page of one rail: pass
starting_after(or thenext_cursorfrom the last response). - Endless feed of titled sections:
getAutoRecommendations()(ormode=auto) returns one section at a time, such as “Because you liked Trail running shoes”, with a cursor for the next.
Handle failures
Recommendations should never break a page. Set a short timeout (the SDKs default to 10 seconds; 1 to 2 seconds is usually right for page rendering), and if the call fails, render a fallback such as best-sellers from your own data or hide the rail.Next
Configure the context
Choose the model, ranking recipe and safety settings for each placement.
Explain a result
Paste a
request_id to see why each item ranked where it did.
