Browsing events

Overview

Browsing events represent customer interactions while browsing your eCommerce site.


trackProductsSearched (Product)

The trackProductsSearched (Product) call is triggered when a customer searches for products. 

Parameters

ParameterData typeDescription
query requiredstringThe query string used to search for products.

Example

affirm.analytics.trackProductsSearched("shirts");

trackProductListViewed (list, [Product])

The trackProductListViewed (list, [Product]) is triggered when a customer views a list of products, such as after completing a search, or on a category page that features multiple products.

Parameters

ParameterData typeDescription
listobjectThe list viewed by customers.
ProductarrayAn array of products present in the list.

Example

affirm.analytics.trackProductListViewed({
    "listId": "L12345",
    "category": "Apparel"
}, [{
    "brand": "Affirm",
    "category": "Apparel",
    "coupon": "SUMMER2018",
    "name": "Affirm T-Shirt",
    "price": 730,
    "productId": "SKU-1234",
    "quantity": 1,
    "variant": "Black"
}, {
    "brand": "Affirm",
    "category": "Apparel",
    "coupon": "SUMMER2018",
    "name": "Affirm Turtleneck Sweater",
    "price": 2190,
    "productId": "SKU-5678",
    "quantity": 1,
    "variant": "Black"
}]);

Objects

List

Represents a list of products appearing on any given page. This is frequently used to track products returned as a search result or included on a category page.

ParameterData typeDescription
listId
required
string
Maximum length: 500
Protocol parameter: ltid
A unique identifier representing the list of products.
category
optional
string
Maximum length: 500
Protocol parameter: ltc
A description of the category the list belongs to, if any.
name
optional
string
Maximum length: 500
Protocol parameter: ltnm
The display name of the list.

Product

Represents any offered product or service.

ParameterDescription
brand
optional
string
Maximum length: 500
Protocol parameter: prbr
The brand of the product (e.g., Affirm).
category
optional
string
Maximum length: 500
Protocol parameter: prca
The category the product belongs to (e.g. Apparel).
coupon
optional
string
Maximum length: 500
Protocol parameter: prcc
Any coupon code associated with the particular instance of this product.
name
optional
string
Maximum length: 500
Protocol parameter: osn
The full name of the product (e.g., Affirm T-Shirt).
price
optional
integer
Protocol parameter: prpr
The price of the product. The value must be non-negative and represented as cents instead of dollars.
productID
optional
string
Maximum length: 500
Protocol parameter: prid
A unique identifier representing the product, such as the SKU or an internal database identifier used by the merchant.
quantity
optional
integer
Protocol parameter: prqt
The quantity of the product. The value must be non-negative.
variant
optional
string
Maximum length: 500
Protocol parameter: prva
The variant of the product (e.g. black).
currency
optional
string
Protocol parameter: prcu
currency code associated with this product (USD)

Did this page help you?