Before you begin
- API URL: Check your API URL. Recommendation requests do not require an access token.
- Ad unit: Get the ID of an ad unit with recommendations enabled from your A2 contact. Your A2 contact sets the recommendation policy, the number of items, and the impression tracking mode on the ad unit.
- Catalog: Register the items to recommend in Product Catalog.
catalog_idin the response is the item ID in the catalog.
Build the request
When you need a recommendation list, callPOST /app/v0/recommendation/{tagid} from the client (web or app) or your server. Put the ad unit ID in tagid. See Serving Recommendation in the API Reference for the available fields.
The number of items is set on the ad unit, not in the request.
Handle the response
Recommendation response example
Handle the response as follows.
Failed requests
Set a maximum time your service waits for recommendations. If that time passes or the request fails, replace it with your service’s default list, and do not show responses that arrive later. With the default settings, A2 returns HTTP408 for requests it cannot process within one second.
Error responses include errorcode and ext.message.
Error response example
tracking_token may change. Use the values of the response you actually showed in events. With On Recommendation Response (on_ad_response), responses that were not shown are also counted as responses.
