Last updated: Mar 01 2018

Area: Episerver Perform, Episerver Reach

Impression Tracking

Episerver marks recommendations sent to a site as rendered on the website. Sometimes not all recommendations are rendered on a web page, so impression tracking ensures accurate reporting to correctly optimize site recommendations based on gathered data.

When products are returned through the PeeriusCallbacks.smartRecs function, two identifying values are included.

  • refCode. Client-side unique identifying code for each product that is passed to Episerver through the product catalog feed.
  • recommendation ID. Value that uniquely identifies each individual recommendation sent to the browser.

Note: For the purposes of impression tracking, Episerver solely uses recommendation IDs for recommendation identification and thus only recommendation IDs are mentioned in this topic. The inclusion of refCodes is for the identification of products on the client server-side only.

Scenario 1: Any page

Episerver sends widget A to a page, which contains 6 recommendation IDs:

Widget A: [ 10001, 10002, 10003, 10004, 10005, 10006 ]

Out of the returned recommendations in the widget you hand-pick only the following to display on the page: 10001, 10002 and 10005, and show them to the user.

Scenario 2: Product Pages

Episerver sends two widgets: A and B, with 6 recommendations in each:

Widget A: [ 10001, 10002, 10003, 10004, 10005, 10006 ]
Widget B: [ 20001, 20002, 20003, 20004, 20005, 20006 ]

You decide to show only the recommendations from widget B with the following IDs: 20001, 20002, 20003, 20004, 20005 and 20006.

Scenario 3: Basket and Interstitial pages

Episerver sends three widgets: A, B and C, and the respective IDs for each widget are:

Widget A: [ 10001, 10002, 10003, 10004, 10005, 10006 ]
Widget B: [ 20001, 20002, 20003, 20004, 20005, 20006 ]
Widget C: [ 30001, 30002, 30003, 30004, 30005, 30006 ]

You decide to show some, but not all, recommendations from Widget A, none from Widget B, and some recommendations from Widget C, as follows:

Widget A: [ 10001, 10003, 10005 ]
Widget B: [ ]
Widget C: [ 30002, 30004, 30006 ]

Impression tracking stages

The implementation of impression tracking consists of two stages:

  • Stage 1. Instruct Episerver to not create impressions for the recommendations returned in the widgets.
  • Stage 2. Instruct Episerver to mark specific recommendations as shown on the site.

Stage 1

To instruct Episerver to stop counting impressions for all recommendation returned in the widgets, include the following JSON object in the PeeriusCallbacks.track variable:

"smartRecs": { 
   "markRecsAsShown": false

The following example shows the above JSON object being used in the PeeriusCallbacks variable on a product page:

var PeeriusCallbacks = {
  track = {
    "product": {
      "refCode": "<refCode1>"
    "type": "product",
    "lang": "de",
    "channel": "web",
    "smartRecs": {
    "markRecsAsShown": false

The next example shows the object used in the tracking variable on the basket page:

var PeeriusCallbacks = {
  "track": {
    "type": "basket",
    "lang": "en-gb",
    "channel": "web",
    "smartRecs": {
      "showAttributes": ["*"],
      "markRecsAsShown": false
    "basket": {
      "items": [{
        "refCode": "<refcode1>",
        "qty": "2",
        "price": "100.00"
      }, {
        "refCode": "<refcode2>",
        "qty": "1",
        "price": "10.00"
      "currency": "GBP"

Add this object to the tracking variable for any page that receives recommendations from Episerver.

Stage 2

After you instruct Episerver to not mark the recommendations as shown (that is, count the impressions), instruct Episerver to create impressions for the recommendations that are actually being displayed. You need the recommendation IDs for the recommendations from Episerver that were displayed on the page. Using the example scenarios, you need the following IDs:

  • Scenario 1: 10001, 10002 and 10005
  • Scenario 2: 20001, 20002, 20003, 20004, 20005 and 20006
  • Scenario 3: 10001, 10003, 10005, and 30002, 30004, 30006

To create the impressions for the displayed recommendations, make a call to a sendAjax function for each of the widgets from which recommendations were displayed, using the recommendation IDs as parameters:

Scenario 1:


Scenario 2:


Scenario 3:


For Scenario 3, you need to make two calls: one for each widget from which recommendations were displayed. In this case, the calls are made to widget A and C.

Note: The <clientname> element is unique for your site and will be provided by Episerver.