Overview
Every successful recommendation response includestracking_token. Error responses do not. tracking_token identifies the returned recommendation result, and recommendation events use this value together with the item ID and position to connect the event to an item of that recommendation.
See Recommendation Requests for how to request recommendations. Sending recommendation logs does not require an access token.
tracking_token is a different value from ext.ad_log in ad responses. Use the tracking_token of the recommendation response exactly as received. If you use a value from another response, the event will not be connected to the intended recommendation.item_impression in User Activity Logs, not as recommendation logs.
Values to keep from the response
When you receive a recommendation response, keeptracking_token together with each item’s catalog_id and position while the list is shown. To measure conversions, pass the values of the clicked item through to purchase completion.
Recommendation response example
Even if your service reorders the items with its own rules or hides some of them, put the response
position in event_position, not the on-screen position. A2 uses this value to find which recommendation method produced the item. Positions that are not in the response are not aggregated.
Response impression tracking
Whenimp is recorded depends on the impression tracking mode of the recommendation placement. Check it in the response’s ext.ad_log_tracking_mode.
Your service sends
vimp, clk, and conv in either mode.
Send events
Send all recommendation events to the event logging API. Onlyaction and the target items differ; the request is the same.
200 does not guarantee that the event is valid or aggregated. Events whose token cannot be read and malformed entries are left out of aggregation, so follow the formats in Request fields.
Request fields
The API Reference marks
event_items and event_position as optional. However, without event_items the event is not reflected in item metrics or the user’s recommendation history, and without event_position vimp, clk, and conv are not counted in recommendation performance metrics. Always send both.
Response impression (imp)
With On Impression Event, send all items of the response once when the recommendation list is shown. Do not send it again when re-rendering the same response or moving to the next page.
sendRecoLog in these examples calls the event logging API.
Viewable impression (vimp)
When recommended items actually appear on screen, send the items that appeared. Put items that appeared at the same time in one event, and do not resend items already sent for the same response. Items of a new recommendation response are sent separately even at the same positions. Each vimp counts as one impression, so sending each item separately inflates the impression count.
IntersectionObserver.
Click (clk)
When a user clicks a recommended item, send that one item. In a browser, the click also navigates to the item page, so use keepalive as in sendRecoLog above.
Conversion (conv)
When a user who clicked a recommended item completes a purchase, send conv with the clicked recommendation’s tracking_token and the purchased item’s catalog_id and position. The values from the click must be carried through the cart and checkout, so this is usually sent from the service server that confirms the purchase.
User recommendation history
If you sentuser.id in the recommendation request, the token carries that user, and the event_items of vimp, clk, and conv are added to the user’s recommendation history. If the recommendation policy has user-history conditions, A2 uses this history to adjust later recommendations, for example by excluding items the user has already seen. imp is not added to the history.
Events of recommendations received without user.id, such as for signed-out users, are counted in performance metrics but not added to any user’s history.
Verify metrics
There is no screen for viewing recommendation performance metrics yet. Organize your service’s records for the same ad unit and period, and compare them with your A2 contact.
Recommendation performance is aggregated per bucket of the recommendation experiment set up by your A2 contact. Events of recommendations served without an experiment are reflected only in item metrics and user history.
There is no screen or API for checking the collection status of individual recommendation logs. Do not resend events to check them.
Common issues
Responses exceed actual renders
Responses exceed actual renders
With On Recommendation Response, responses that were not shown are also counted. With On Impression Event, check that
imp is not sent repeatedly for the same response.Clicks or viewable impressions are not counted
Clicks or viewable impressions are not counted
Check that
type is reco_log, that tracking_token is unmodified, and that event_position contains the response position.Performance by position does not match
Performance by position does not match
Check that you are not sending the reordered on-screen position in
event_position, and that event_items and event_position are in the same order.Conversions are not counted
Conversions are not counted
Check that the clicked recommendation’s
tracking_token and position reach the purchase step. A token from another recommendation response is not connected.You cannot tell whether to resend after a timeout
You cannot tell whether to resend after a timeout
A timeout alone does not tell you whether the event was processed. Resending may double-count, so check with your A2 contact first.
