Skip to content

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:

VarTypeDescription
product_idintUnique product id (not cross-tenant)
product_id_variationint/nullUnique product variation/combination id (not cross-tenant)
product_id_contextstringSame product id + tenant unique code (cross-tenant)
product_skustringProduct SKU (cross-tenant)
product_namestringProduct name (translated)
product_name_variationstringProduct variation/combination name (translated)
product_unitpricestringProduct unit price (default currency)
product_discountstringProduct discount price (default currency)
product_unitofficial_pricestringProduct official list price (default currency)
product_stock_availabilityintAvailable stocks (all types)
product_urlstringProduct page URL (tenant based, translated)
product_url_imgstringProduct cover image URL (tenant based, CDN)
product_qtyintProduct quantity in the context (added, updated, deleted)
product_brandstringProduct brand (cross-tenant)
product_brand_idintUnique Product brand id (not cross-tenant)
product_collectionstringProduct collection (cross-tenant)
product_collection_idintUnique Product collection id (not cross-tenant)
product_cat1_namestringProduct main category (cross-tenant)
product_cat1_idintUnique Product main category id (not cross-tenant)
product_cat2_namestringProduct default category (cross-tenant)
product_cat2_idintUnique Product default category id (not cross-tenant)
product_cat3_namestring/nullProduct sub category (cross-tenant)
product_cat3_idint/nullUnique Product sub category id (not cross-tenant)
product_genderchar(1)Product category gender code:
[M]an / [W]oman / [U]nisex / [C]hild
product_ispromotionboolProduct status flag "in promotion"
product_isnewint(1)Product status flag "new"
product_isoutletint(1)Product status flag "outlet"
product_isoutofprodint(1)Product status flag "out-of-production"
liststring/nullDefine 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 
    }
]}

Released under the MIT License.