Skip to main content
A recommendation request asks: “what should this person see in this placement?”. It names a context and, usually, a user, and returns a ranked list plus a request_id.

The basic request

See the endpoint reference for every parameter.

The response

Render from each item’s 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_id or basket seed.
  • Anonymous visitors: send a stable anonymous_id or a session-scoped user_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 own request_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 status and error; the others still return.
  • Use a stable request_id when 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.
To stop the same item appearing in two rails on a page, put those contexts in a context group.

Paged and endless feeds

  • Next page of one rail: pass starting_after (or the next_cursor from the last response).
  • Endless feed of titled sections: getAutoRecommendations() (or mode=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.