Interface: RecommendationsNamespace
Defined in: types.ts:1053
Recommendation fetching and click reporting methods, available as
allegro.recommendations.
Methods
get()
get(
options?):Promise<RecommendationSet>
Defined in: types.ts:1062
Fetch ranked recommendations for this reader.
Parameters
| Parameter | Type |
|---|---|
options? | RecommendationsGetOptions |
Returns
Promise<RecommendationSet>
Example
const { items } = await allegro.recommendations.get({ limit: 6 });
trackClick()
trackClick(
item,options?):Promise<void>
Defined in: types.ts:1082
Report that the reader clicked one of the items get() returned.
Pass the item object itself — the SDK remembers which request served
it, so nothing else is needed. options.position is the only field the
caller can override — useful when the item was re-rendered or reordered
and the caller knows its displayed position better than the SDK's
original index; requestId, device, sourcePath, and strategy
always come from the recorded origin, not from options.
Parameters
| Parameter | Type |
|---|---|
item | RecommendationItem |
options? | { position?: number; } |
options.position? | number |
Returns
Promise<void>
Throws
AllegroApiError when the item cannot be traced to a request, or when its path appears in two different result sets on this page.
Example
link.addEventListener('click', () => allegro.recommendations.trackClick(item));