ContentView
contentView
Required event. Handling this event on your Barion shop's screens is required as part of a Barion Full Pixel implementation.
Short description
The event contributes to understanding and monitoring a user's e-commerce behavior patterns by retrieving product- and offer-related information whenever the user visits a page that lists one or more items for sale, or that displays promotional information (news, description, blog post, etc.) about a single item for sale.
Your webshop can be handling several
contentView
Barion Pixel events, depending on the type of content loaded.A Barion Full Pixel implementation requires at least a
contentView
event handler where"contentType": "Product"
.
Trigger
A page load event of either a page that lists items for sale, or, preferably, a page that displays a single item for sale.
Properties
Custom properties are supported.
Name | Data type | Description | Required? | Note |
---|---|---|---|---|
contentType | One of the following string options: "Page", "Product", "Article", "Promotion", "Banner", "Misc" | The type of page that triggered the event. | yes | In case this is an item listing page, pass "Product". Otherwise, select the option that best matches the type of page. See the event's list property also.
|
currency | string (ISO 4217 currency code) | yes | Required if "contentType": "Product"
| |
id | string | A unique identifier for the item or promotional material, such as a product ID, SKU, or promotion ID. | yes | |
name | string | The full name associated with the item or promotional material, or the title of the visited page. Make sure that you use the same name across Barion Pixel events for the same item or promotional material. |
yes | |
quantity | float | The quantity that is displayed on the page for the item on sale. | yes | Required if "contentType": "Product"
|
unit | string | The displayed item's unit (e.g. piece, set, liter). | yes | Required if "contentType": "Product"
|
unitPrice | float | The price of a single unit of the item for sale, in the currency property.
|
yes | Required if "contentType": "Product"
|
brand | string | The item's brand. | no | |
category | string | -separated subcategory chain (e.g. "clothes|shoes|winter") or the single category (e.g. "winter shoes") of the item for sale. | no | |
contents | array | An array of content objects if the page displays multiple items for sale. | no | Don't include shipping or coupons. |
creative | string | The associated promotion's name or description, such as an advertising slogan or the name of the promotional image file. | no | |
customerValue | float | Your self-defined metric that represents the business value of the given customer (based on for example their average basket value). | no | |
ean | string | The item's International Article Number (EAN). | no | |
imageUrl | string | The URL of the item's image. | no | |
list | string | Select the function of the visited page from one of the following string options: "HomePage", "SearchPage", "ProductPage", "Recommendation", "ComparisonPage", "BasketPage", "Checkout", "Misc" | no | |
positioning | string | The item's position in a list or collection (e.g. 2) or the position of its promotion on the page (e.g. banner_slot_1). | no | |
step | integer | The order that the visited page is displayed in within a multi-step checkout process, if applicable. | no | Step numbering starts at 1. |
variant | string | The variant of the item on sale that distinguishes it from other similar items (such as color, material, or time and date). | no |
Barion Pixel throws the following errors in your browser console if a required property is missing or is passed in the wrong format:
"Barion Pixel: Format of PROP_NAME is invalid in EVENT_NAME"
"Barion Pixel: The PROP_NAME parameter of the EVENT_NAME event cannot be empty"
Sample implementation
Physical product
// on product page
var contentViewProperties = {
'contentType': 'Product',
'currency': 'HUF',
'id': 'item_42',
'name': "Hitchhikers' Guide to the Galaxy, hardcover, ISBN: 9780575115347",
'quantity': 10.0,
'unit': 'pcs.',
'unitPrice': 4990.0,
'brand': 'Gollancz',
'category': 'books|hardcover|scifi, books|hardcover|comedy',
'customerValue': 150.0,
'ean': '9780575115347',
'imageUrl': 'https://images-na.ssl-images-amazon.com/images/I/51MzUz8rQcL._SX305_BO1,204,203,200_.jpg',
'list': 'ProductPage',
'variant': 'hardcover'
}
// on home page for a promotion of a product
var contentViewProperties = {
'contentType': 'Promotion',
'currency': 'HUF',
'id': 'item_42',
'name': "Hitchhikers' Guide to the Galaxy, hardcover, ISBN: 9780575115347",
'quantity': 10.0,
'unit': 'pcs.',
'unitPrice': 4990.0,
'brand': 'Gollancz',
'category': 'books|hardcover|scifi, books|hardcover|comedy',
'creative': 'book_promo_02',
'customerValue': 150.0,
'ean': '9780575115347',
'imageUrl': 'https://images-na.ssl-images-amazon.com/images/I/51MzUz8rQcL._SX305_BO1,204,203,200_.jpg',
'list': 'HomePage',
'positioning': '2',
'variant': 'hardcover'
}
// on checkout page for a promotion of a product
var contentViewProperties = {
'contentType': 'Promotion',
'currency': 'HUF',
'id': 'item_42',
'name': "Hitchhikers' Guide to the Galaxy, hardcover, ISBN: 9780575115347",
'quantity': 10.0,
'unit': 'pcs.',
'unitPrice': 4990.0,
'brand': 'Gollancz',
'category': 'books|hardcover|scifi, books|hardcover|comedy',
'creative': 'also_bought_05',
'customerValue': 150.0,
'ean': '9780575115347',
'imageUrl': 'https://images-na.ssl-images-amazon.com/images/I/51MzUz8rQcL._SX305_BO1,204,203,200_.jpg',
'list': 'Checkout',
'positioning': '5',
'step': 2,
'variant': 'hardcover'
}
bp('track', 'contentView', contentViewProperties);
Virtual product (concert ticket)
// concert ticket product page
var contentViewProperties = {
'contentType': 'Product',
'currency': 'GBP',
'id': 'metalica_12',
'name': 'Metallica',
'quantity': 1.0,
'unit': 'pcs.',
'unitPrice': 300.0,
'category': 'Pop|Metal',
'customerValue': 150.0,
'imageUrl': "https://www.revolvermag.com/sites/default/files/styles/image_954_x_537/public/media/images/article/metallicapr.jpg",
'list': 'ProductPage',
'variant': '2019.06.08 20:00|Slane Castle'
}
// home page for a promotion of concert ticket
var contentViewProperties = {
'contentType': 'Promotion',
'currency': 'GBP',
'id': 'metalica_12',
'name': 'Metallica',
'quantity': 1.0,
'unit': 'pcs.',
'unitPrice': 300.0,
'category': 'Pop|Metal',
'creative': 'metallica_promo_02',
'customerValue': 150.0,
'imageUrl': "https://www.revolvermag.com/sites/default/files/styles/image_954_x_537/public/media/images/article/metallicapr.jpg",
'list': 'HomePage',
'positioning': '2',
'variant': '2019.06.08 20:00|Slane Castle'
}
// checkout page for a promotion of a product
var contentViewProperties = {
'contentType': 'Promotion',
'currency': 'GBP',
'id': 'metalica_12',
'name': 'Metallica',
'quantity': 1.0,
'unit': 'pcs.',
'unitPrice': 300.0,
'category': 'Pop|Metal',
'creative': 'also_bought_05',
'customerValue': 150.0,
'imageUrl': "https://www.revolvermag.com/sites/default/files/styles/image_954_x_537/public/media/images/article/metallicapr.jpg",
'list': 'Checkout',
'positioning': '5',
'step': 2,
'variant': '2019.06.08 20:00|Slane Castle'
}
bp('track', 'contentView', contentViewProperties);