Products, promotions and contents tracking¶
Products, promotions and contents are related to the content web component as mentioned in the web component documentation.
For each of these 3 types of contents it is possible to view multiple elements at once. Therefore, you have to provide an array of these elements when the user interacts with an element. This is the case for both the contentview as well as the click. Even though you will always click on only one element.
We have defined a few default content interactions related to products, promotions and content. For more information read our content related interactions documentation.
The example code below is written in the Javascript API syntax, but it is also possible to make use of the data-attributes.
For more information, read the data attributes documentation.
Products¶
Below you will find the tracking code for products.
harvest.trackEvent({
"event":"contentview",
"data": {
"contentInteractionName": "Product list view",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
"position": 1, //The index of the product in the list
"list": "Featured products" //Required for list actions
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Product list click",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
"position": 1, //The index of the product in the list
"list": "Featured products" //Required for list actions
}]
}
});
harvest.trackEvent({
"event":"contentview",
"data": {
"contentInteractionName": "Product detail view",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Product add to cart",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
"quantity": 1
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Product remove from cart",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
"quantity": 1
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Product add to wishlist",
"products":[{
"name": "Product name", //Either name or id is required
"id": "Product ID", //Either name or id is required
"price": 100,
"brand": "Product brand",
"variant": "Product variant",
"category": "Level 1/Level 2", //Up to 5 levels
"quantity": 1
}]
}
});
Promotions¶
Below you will find the tracking code for promotions.
harvest.trackEvent({
"event":"contentview",
"data": {
"contentInteractionName": "Promotion view",
"promotions":[{
"name": "Promotion name", //Either name or id is required
"id": "Promotion ID", //Either name or id is required
"blockName": "Block name", //This is the name of the promotion block
"position": 1 //Index of the promotion in the block
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Promotion click",
"promotions":[{
"name": "Promotion name", //Either name or id is required
"id": "Promotion ID", //Either name or id is required
"blockName": "Block name", //This is the name of the promotion block
"position": 1 //Index of the promotion in the block
}]
}
});
Contents¶
Below you will find the tracking code for promotions.
harvest.trackEvent({
"event":"contentview",
"data": {
"contentInteractionName": "Promotion view",
"contents":[{
"name": "Content name", //Either name or id is required
"id": "Content ID", //Either name or id is required
"type": "Content type",
"variant": "Content variant",
"position": 1 //Index of the promotion in the block
}]
}
});
harvest.trackEvent({
"event":"click",
"data": {
"contentInteractionName": "Content click",
"contents":[{
"name": "Content name", //Either name or id is required
"id": "Content ID", //Either name or id is required
"type": "Content type",
"variant": "Content variant",
"position": 1 //Index of the promotion in the block
}]
}
});