Recommendations
Also viewed
Customers-also-viewed rail driven by precomputed co-view counts.
GET /recommendations/also-viewed returns items that other users viewed in the same session as the seed item. Backed by precomputed co-view co-occurrence — not semantic similarity.
Request
GET /recommendations/also-viewed?indexId=<id>&itemId=<id>&limit=10
Authorization: Bearer <api-key>| Param | Type | Required | Notes |
|---|---|---|---|
indexId | string | yes | Source index. |
itemId | string | yes | Seed item. |
limit | number | no | 1–50, default 10. |
Response
{
"items": [
{ "id": "sku-9001", "score": 142, "data": { ... } }
],
"anchorId": "sku-0001",
"engine": "also-viewed"
}score is the raw co-view count over the trailing window (default 30 days).
When to use
- PDP "Customers also viewed" rail — Classic ecommerce surface; complements
similar(semantic) with behavioural data. - Search results dwell page — When a user views one result, suggest others people clicked from the same query.
Cold start
If the seed item has no co-view history (< 10 sessions), the engine falls back to Trending within the same category. The response's engine field will be "trending" in that case — branch your UI on it if you want different labelling.
Latency
p95 ~50 ms on Pro. The co-occurrence map is precomputed nightly; the API is a hash lookup.
Code path
packages/api/modules/recommendations/procedures/also-viewed.ts.