Product list and promotion attribution¶
We use product lists to show off products and we use promotions to promote certain actions we want a user to perform. The interaction with a product list and promotion will hopefully trigger a series of events. These events, however, can be much later in a session or customer journey.
In Harvest Collect we save the last clicked product list and promotion. We will enrich it to any event. This will make it possible to link events that were done after a click on a product list or promotion to that specific product list or promotion.
To follow the steps in this documentation, it is recommended to check our console debugging documentation. Turn on debugging, so you can follow along. You do this by executing harvest.setDebug() in the console. After that, refresh the page as indicated in the console.
Product list¶
Product lists are used to showcase products. On the one hand you have default lists of products on category pages, but you also have more special product lists like the “Featured products” or “People also bought” lists.
These lists are often in valuable positions, so you want to know how they perform. To demonstrate how this works for product lists, let’s open an incognito window and go to the Chrome developer tools. Then execute the following event:
harvest.trackEvent({
"event":"click",
"data": {
"clickType": "productListClick",
"products": [{
"id": "123sdfsfd123",
"name": "Baseball Jacket Grain",
"price": 99.95,
"list": "Featured items",
"position" : 1
}]
}
});
The above code demonstrates a click on a product in a list. Note that the attribution is only activated while tracking the click. In this case the list of the first item in the products array is linked to “lastClickedProductList”.
After you have done this, you could execute any other event. For example a pageview.
harvest.trackEvent({
"event":"pageview",
"data": {}
});
After you have done this, drill down in the “Distributing - pageview”.
As you can see, in eventData the lastClickedProductList property now has an object attached to it. It has the name of the list and the timestap for the moment it was set.
Promotion¶
We could do the same for a promotion. Only when clicking a promotion will the “lastClickedPromotion” be set.
harvest.trackEvent({
"event":"click",
"data": {
"clickType": "promotionClick",
"promotions": [{
"id": "homepage-header",
"name": "Homepage header",
"creative": "Super Baseball 50%-off",
"position" : 1
}]
}
});
The above code is an example of a click on a promotion.
After you have done this, you could execute any other event. For example a pageview.
harvest.trackEvent({
"event":"pageview",
"data": {}
});
Then again, you can drilldown the “Distributing - pageview” logging.
As you can see, now the promotion object is linked to eventData. You can also still see that the product list is still visible. The links will live as long as the current session stays open.