Skip to main content
Recommendation logs tell A2 about impressions, clicks, and conversions of the A2 recommendation results shown in your service. A2 uses these records to aggregate recommendation performance and update each user’s recommendation history.

Overview

Every successful recommendation response includes tracking_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.
Send impressions of your service’s own lists that A2 did not recommend as item_impression in User Activity Logs, not as recommendation logs.

Values to keep from the response

When you receive a recommendation response, keep tracking_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

When imp 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. Only action and the target items differ; the request is the same.
HTTP 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.
Your service decides whether an item is visible. On the web, you can use a method that detects when an element enters the viewport, such as 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.
You can also send it from your service server. Do not send one click from both the client and the server.

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.
Which action counts as a conversion, how long after a click a purchase is still attributed, and how cancellations are handled all differ by customer. To measure conversions, agree on the method with your A2 contact first. Recommendation logs do not aggregate purchase amounts. Sending purchase events through User Activity Logs does not record recommendation conversions. The two logs serve different purposes, so send both.

User recommendation history

If you sent user.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

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.
Check that type is reco_log, that tracking_token is unmodified, and that event_position contains the response position.
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.
Check that the clicked recommendation’s tracking_token and position reach the purchase step. A token from another recommendation response is not connected.
A timeout alone does not tell you whether the event was processed. Resending may double-count, so check with your A2 contact first.
If the problem continues, prepare the time, ad unit, event type, and the request and HTTP response with sensitive data removed, and contact your A2 representative.

Next steps

Register the items to recommend in Product Catalog, and send user behavior across your service through User Activity Logs.