Appearance
Scope "products" events
Basically You are free to subscribe to general events that are fired outside (or event inside) a "cart/checkout" scope, such "adding products to cart" from any location (even landing pages);
so these events cover especially CRUD (Create/Request/Update/Delete) events about products and the current Cart in the user's session.
onCartAdd
Fired whenever a "product" (or a "variant", or a "combination") is added to the current cart.
Let's review an example:
js
{
"product_id": 56400,
"product_id_variation": "",
"product_id_context": "56400BS",
"product_sku": "R8853121004",
"product_name": "Orologio Maserati Successo - R8853121004",
"product_name_variation": "",
"product_unitprice": "103.81",
"product_discount": "15.02",
"product_unitofficial_price": "122.13",
"product_stock_availability": 330,
"product_url": "https://www.bluespirit.com/orologio-maserati-successo-r8853121004-P56400.htm",
"product_url_img": "https://www.bluespirit.com/i/default/73228/orologio-maserati-successo-r8853121004.jpg",
"product_qty": 1,
"product_brand": "Maserati",
"product_brand_id": 122,
"product_collection": "Successo",
"product_collection_id": 1365,
"product_cat1_name": "Orologi",
"product_cat1_id": 1,
"product_cat2_name": "Just time",
"product_cat2_id": 9,
"product_cat3_name": "",
"product_cat3_id": "",
"product_gender": "M",
"product_ispromotion": true,
"product_isnew": 0,
"product_isoutlet": 0,
"product_isoutofprod": 0,
"list": null
}
Variables full details
Here you can find a detailed description of each variable or sub-branch:
Var | Type | Description |
---|---|---|
product_id | int | Unique product id (not cross-tenant) |
product_id_variation | int/null | Unique product variation/combination id (not cross-tenant) |
product_id_context | string | Same product id + tenant unique code (cross-tenant) |
product_sku | string | Product SKU (cross-tenant) |
product_name | string | Product name (translated) |
product_name_variation | string | Product variation/combination name (translated) |
product_unitprice | string | Product unit price (default currency) |
product_discount | string | Product discount price (default currency) |
product_unitofficial_price | string | Product official list price (default currency) |
product_stock_availability | int | Available stocks (all types) |
product_url | string | Product page URL (tenant based, translated) |
product_url_img | string | Product cover image URL (tenant based, CDN) |
product_qty | int | Product quantity in the context (added, updated, deleted) |
product_brand | string | Product brand (cross-tenant) |
product_brand_id | int | Unique Product brand id (not cross-tenant) |
product_collection | string | Product collection (cross-tenant) |
product_collection_id | int | Unique Product collection id (not cross-tenant) |
product_cat1_name | string | Product main category (cross-tenant) |
product_cat1_id | int | Unique Product main category id (not cross-tenant) |
product_cat2_name | string | Product default category (cross-tenant) |
product_cat2_id | int | Unique Product default category id (not cross-tenant) |
product_cat3_name | string/null | Product sub category (cross-tenant) |
product_cat3_id | int/null | Unique Product sub category id (not cross-tenant) |
product_gender | char(1) | Product category gender code: [M]an / [W]oman / [U]nisex / [C]hild |
product_ispromotion | bool | Product status flag "in promotion" |
product_isnew | int(1) | Product status flag "new" |
product_isoutlet | int(1) | Product status flag "outlet" |
product_isoutofprod | int(1) | Product status flag "out-of-production" |
list | string/null | Define the actual catalogue listing page, and can be filled with several strategies (for example a brand or a category name); Important: when the page is the search's result page submitted by a user, this variable will always be equal to "search-results" |
onCartUpdate
Fired whenever a "product" (or a "variant", or a "combination") is updated in the current cart.
PLEASE REMEMBER:
In order to be consistent the payload is identical to the one detailed in the onCartAdd - Variables full details section.
onCartDelete
Fired whenever a "product" (or a "variant", or a "combination") is removed/deleted from the current cart.
PLEASE REMEMBER:
In order to be consistent the payload is identical to the one detailed in the onCartAdd - Variables full details section.
onProductClick
Fired whenever a "product" is clicked from the current catalogue's page or from a carousel (for example in a product's details page).
PLEASE REMEMBER:
In order to be consistent the payload is identical to the one detailed in the onCartAdd - Variables full details section.
onProductImpression
Fired whenever a "product" is rendered/showed into the current catalogue's page or in a carousel (for example in a product's details page).
PLEASE REMEMBER:
In order to be consistent the payload is identical to the one detailed in the onCartAdd - Variables full details section.
IMPORTANT:
Actual firing of this (single) event could be overwritten by the "bulk" version, where an array of "products" are fires in a single event (please refer to the next block below).
onAllProductImpression
Fired whenever a "product" is rendered/showed into the current catalogue's page or in a carousel (for example in a product's details page).
IMPORTANT:
The payload is an object with a single property named "impressions_array", which is an array of standard "product" objects;
PLEASE REMEMBER:
In order to be consistent the payload is identical to the one detailed in the onCartAdd - Variables full details section.
Let's see an example:
js
{
"impressions_array": [
{
"product_id": 56400,
"product_id_variation": "",
"product_id_context": "56400BS",
"product_sku": "R8853121004",
"product_name": "Orologio Maserati Successo - R8853121004",
"product_name_variation": "",
"product_unitprice": "103.81",
"product_discount": "15.02",
"product_unitofficial_price": "122.13",
"product_stock_availability": 330,
"product_url": "https://www.bluespirit.com/orologio-maserati-successo-r8853121004-P56400.htm",
"product_url_img": "https://www.bluespirit.com/i/default/73228/orologio-maserati-successo-r8853121004.jpg",
"product_qty": 1,
"product_brand": "Maserati",
"product_brand_id": 122,
"product_collection": "Successo",
"product_collection_id": 1365,
"product_cat1_name": "Orologi",
"product_cat1_id": 1,
"product_cat2_name": "Just time",
"product_cat2_id": 9,
"product_cat3_name": "",
"product_cat3_id": "",
"product_gender": "M",
"product_ispromotion": true,
"product_isnew": 0,
"product_isoutlet": 0,
"product_isoutofprod": 0,
"list": null
},
{
"product_id": 56400,
"product_id_variation": "",
"product_id_context": "56400BS",
"product_sku": "R8853121004",
"product_name": "Orologio Maserati Successo - R8853121004",
"product_name_variation": "",
"product_unitprice": "103.81",
"product_discount": "15.02",
"product_unitofficial_price": "122.13",
"product_stock_availability": 330,
"product_url": "https://www.bluespirit.com/orologio-maserati-successo-r8853121004-P56400.htm",
"product_url_img": "https://www.bluespirit.com/i/default/73228/orologio-maserati-successo-r8853121004.jpg",
"product_qty": 1,
"product_brand": "Maserati",
"product_brand_id": 122,
"product_collection": "Successo",
"product_collection_id": 1365,
"product_cat1_name": "Orologi",
"product_cat1_id": 1,
"product_cat2_name": "Just time",
"product_cat2_id": 9,
"product_cat3_name": "",
"product_cat3_id": "",
"product_gender": "M",
"product_ispromotion": true,
"product_isnew": 0,
"product_isoutlet": 0,
"product_isoutofprod": 0,
"list": null
}
]}