Clear History

Track Product Views

Product view events are commonly used to track a user visiting a product page.

Product view


Product view events

In this section, we will showcase how to track product view events.

ProductViewEvent

To track a product view you can use the ProductViewEvent with the following attributes:

ProductViewEvent(product: ProductEntity)
  • Where product is the product being viewed.

Example usage:

let product = ProductEntity(
  id: "plow2", 
  category: "snow.clearance.ploughs.large", 
  currency: "NOK", 
  price: 5000
)
let event = ProductViewEvent(product: product)

tracker.track(event)

ProductViewEvent

To track a product view you can use the ProductViewEvent with the following attributes:

ProductViewEvent(product: ProductEntity)
  • Where product is the product being viewed.

Example usage:

val product = ProductEntity(
    id = "plow2", 
    category = "snow.clearance.ploughs.large", 
    currency = "NOK", 
    price = 5000
)
val event = ProductViewEvent(product)

tracker.track(event)

ProductViewEvent

To track a product view you can use the ProductViewEvent with the following attributes:

ProductViewEvent(product: ProductEntity);
  • Where product is the product being viewed.

Example usage:

ProductViewEvent event = new ProductViewEvent(new ProductEntity(
    "plow2", // id
    "snow.clearance.ploughs.large",  // category
    "NOK", // currency
    5000 // price
  )
); 

tracker.track(event);

Where ProductEntity can have the following attributes:

attributetypedescriptionrequired
idstringSKU or product ID.
currencystringCurrency in which the product is being priced (ISO 4217).
pricenumberPrice of the product at the current time.
namestringName or title of the product.
categorystringCategory the product belongs to. Use a consistent separator to express multiple levels. E.g. Woman/Shoes/Sneakers. The number of levels is defined by the user.
listPricenumberRecommended or list price of a product.
quantitynumberQuantity of the product taking part in the action. Used for Cart events.
sizestringSize of the product. E.g. XL, XS, M.
variantstringVariant of the product. E.g. Red, Heavy, Leather.
brandstringBrand of the product.
inventoryStatusstringInventory status of the product. E.g. in stock, out of stock, preorder, backorder.
positionnumberPosition the product was presented in a list of products. Used in Product List events.
creativeIdstringIdentifier/Name/Url for the creative presented on a list or product view.