ProductView
ProductView
This is for:
DeveloperThe ProductView
controller provides an interface for triggering an analytics event for a product view.
Methods
view
Trigger a view event for the product.
Parameters
-
product:
Product
The product view event payload.
Initialize
buildProductView
Creates an ProductView
controller instance.
Parameters
-
engine:
CommerceEngine
The headless commerce engine.
Returns ProductView
Related Types
HighlightKeyword
Properties
-
length:
number
The length of the offset.
-
offset:
number
The 0 based offset inside the string where the highlight should start.
Product
Properties
-
position:
number
The 1-based product’s position across the non-paginated result set.
E.g., if the product is the third one on the second page, and there are 10 products per page, its position is 13 (not 3).
-
additionalFields:
Record<string, unknown>
The requested additional fields for the product.
-
children:
Omit<BaseProduct, 'children' | 'totalNumberOfChildren'>
The child products of the product, fetched through product grouping.
-
clickUri:
string
The URL of the product.
-
ec_brand:
string | null
The brand of the product.
From the
ec_brand
field. -
ec_category:
string[]
The category of the product (e.g.,
"Electronics;Electronics|Televisions;Electronics|Televisions|4K Televisions"
).From the
ec_category
field. -
ec_color:
string | null
The color of the product.
-
ec_description:
string | null
The description of the product.
From the
ec_description
field. -
ec_gender:
string | null
The gender the product is intended for.
-
ec_images:
string[]
The URLs of additional product images.
From the
ec_images
field. -
ec_in_stock:
boolean | null
Whether the product is currently in stock.
From the
ec_in_stock
field. -
ec_item_group_id:
string | null
The ID used for the purpose of product grouping.
From the
ec_item_group_id
field. -
ec_listing:
string | null
The listing that the product belongs to.
-
ec_name:
string | null
The name of the product.
From the
ec_name
field. -
ec_price:
number | null
The base price of the product.
From the
ec_price
field. -
ec_product_id:
string | null
The product ID.
-
ec_promo_price:
number | null
The promotional price of the product.
From the
ec_promo_price
field. -
ec_rating:
number | null
The product rating, from 0 to 10.
From the
ec_rating
field. -
ec_shortdesc:
string | null
A short description of the product.
From the
ec_shortdesc
field. -
ec_thumbnails:
string[]
The URLs of the product image thumbnails.
From the
ec_thumbnails
field. -
permanentid:
string
The SKU of the product.
-
totalNumberOfChildren:
number | null
The total number of child products fetched through product grouping.
-
excerpt?:
string | null
The contextual excerpt generated for the product.
-
excerptsHighlights?:
HighlightKeyword[]
The length and offset of each word to highlight in the product excerpt string.
-
nameHighlights?:
HighlightKeyword[]
The length and offset of each word to highlight in the product name.