Category Page Events API 4.0 Reference
Tracking category page views
View – event
The event must be raised when the Category page is viewed. It must be called on the page load.
Syntax:
Prefixbox.categoryView(params, async)
Required fields of the params object:
- id: the unique identifier of the category
- name: the full path of the category
- url: the URL of the category
- count: the number of items displayed on the category page
Optional fields of the params object:
- query: the search keyword executed by the user
- filter: the selected attribute filter on the category page
Optional:
- async: sends the event data asynchronously (optional, default: true)
Example:
<script> window.addEventListener('load', function (e) { Prefixbox.categoryView({ 'id':'catId78', 'name':'Garden/Tools/Hammer', 'url':'www.shop.com/Garden/Super_Hammer', 'count':'190', 'filter':'Price ge 100 and Price le 300 and Color eq "red"'}) }); </script>
Tracking category page clicks
Click – event
The event must be raised when the item on category page is being clicked.
Syntax:
Prefixbox.categoryClick(params, async)
Required fields of the params object:
- id: the unique identifier of the category
- name: the full path of the category
- url: the URL of the category
- productId: the unique identifier of the clicked product
- productTitle: the name of the clicked product
- productUrl: the URL of the clicked product
- position: the sum of the clicked item’s index on the current page (starting from 1) and the number of items on the previous pages
Optional fields of the params object:
- query: the search keyword executed by the user on the Category page
Optional:
- async: sends the event data asynchronously (optional, default: true)
Example (inline):
<script>
document.getElementById("productDiv").addEventListener('click', function (e) {
Prefixbox.categoryClick({
'id':'catId78',
'name':'Garden/Tools/Hammer',
'url':'www.shop.com/Garden/Super_Hammer',
'productId':'prodId89',
'productTitle':'Super Steel Hammer',
'productUrl':'www.shop.com/Super_Steel_Hummer',
'position':'190'});
});
</script>
Tracking category page carts
Cart- event
The event must be raised when the item on category page is added to cart.
Syntax:
Prefixbox.categoryCart(params, async)
Required fields of the params object:
- id: the unique identifier of the category
- name: the full path of the category
- url: the URL of the category
- productId: the unique identifier of the clicked product
- productTitle: the name of the clicked product
- productUrl: the URL of the clicked product
- price: the price of the product
- itemCount: the number of the items added to the cart
- position: the sum of the clicked item’s index on the current page (starting from 1) and the number of items on the previous pages
Optional fields of the params object:
- query: the search keyword executed by the user on the Category page
- currency: the currency of the product price
Optional:
- async: sends the event data asynchronously (optional, default: true)
Example (inline):
<script> document.getElementById("addToCartBtn").addEventListener('click', function (e) { Prefixbox.categoryCart({ 'id':'catId78', 'name':'Garden/Tools/Hammer', 'url':'www.shop.com/Garden/Super_Hammer', 'productId':'prodId89', 'productTitle':'Super Steel Hammer', 'productUrl':'www.shop.com/Super_Steel_Hummer', 'price':34.99, 'itemCount':2, 'currency':'USD', 'position':'190'}); }); </script>