RecommendationTracker
is used to send recommendation panel-related events:
offer
: when a piece of content is presented to a userchoice
: when a user clicks on the presented contentThe RecommendationTracker
object can be obtained from a PageTracker
instance by calling the newRecommendationTracker
method. The tracker should be used for every element within the same recommendation panel. You will need to provide a RecommendationContext
instance.
You create a RecommendationTracker for each panel
on your page. A panel is a visual collection of content. For example a “popular” lane on NPO start is a panel. It does not matter if the panel contains algorithmic or editorial content. They can be tracked in the same way.
Parameters :
panel_id
: Identifier of the panel (should be discussed in the tagplan)total_offers
: Total amount of items offered in this panelpanel_format
: UX-format of the recommendation panel (fixed set should be discussed in the tagplan)panel_position
(Optional) Position of the panel on the page (starts from 0)const recommendationTracker = npotag.newRecommendationTracker(pageTracker, {
panel_id: '23889851-fec5-4106-8501-122f1e233686',
total_offers: 9,
panel_format: '5grid',
panel_position: 0,
});
const recommendationTracker = newRecommendationTracker(pageTracker, {
panel_id: '23889851-fec5-4106-8501-122f1e233686',
total_offers: 9,
panel_format: '5grid',
panel_position: 0,
});
let recommendationContext = RecommendationContext(
panelId: "panelId",
totalOffers: offers.count,
panelFormat: "panelFormat",
panelPosition: 0
)
// Create a recommendation tracker instance from our pageTracker
let recommendationTracker = pageTracker.newRecommendationTracker(
withContext: recommendationContext
)
val recommendationTracker = pageTracker.recommendationTrackerBuilder()
.withPanelId(panelId)
.withTotalOffers(NUMBER_OF_ITEMS)
.withPanelFormat("panelFormat")
.withPanelPosition(panelPosition)
.build()
Sends an offer
event with the content details. You should call the method every time an item in the panel is shown to the user.
Parameters:
recommender
: Recommendation algorithm used OR title of the panel formatted according to the tagplantarget_id
: ID of the content being offeredoffer_index
: Position of the offer within the panel (starts from 0)recommendationTracker.offer({
recommender: 'ps-implicit-v0',
target_id: 'VPWON_123',
offer_index: 2,
});
recommendationTracker.offer({
recommender: 'ps-implicit-v0',
target_id: 'VPWON_123',
offer_index: 2,
});
recommendationTracker.offer(recommender: String, targetId: String, offerIndex: Int)
recommendationTracker.offer(
recommender = "recommender",
targetId = "targetId",
offerIndex = 1
)
Sends a choice
event with the details of the selected content. This should be sent when the content in a panel is clicked and the
user is navigating to that content.
Parameters:
recommender
: Recommendation algorithm used OR title of the panel formatted according to the tagplantarget_id
: ID of the selected offered contentoffer_index
: Position of the selected offer within the recommendation panel (starts from 0)recommendationTracker.choice({
recommender: 'ps-implicit-v0',
target_id: 'VPWON_123',
offer_index: 3,
});
recommendationTracker.choice({
recommender: 'ps-implicit-v0',
target_id: 'VPWON_123',
offer_index: 3,
});
recommendationTracker.choice(recommender: String, targetId: String, offerIndex: Int)
recommendationTracker.choice(
recommender = "recommender",
targetId = "targetId",
offerIndex = 1
)