Product events
Overview
Product events represent the customer's journey as they choose and decide the product to order.
trackProductClicked (Product)
An event triggered when a customer clicks on a product link to view more details.
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The product that the customer clicks on. |
Example
affirm.analytics.trackProductClicked({
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
});
trackProductViewed (Product)
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The product the customer viewed. |
Example
affirm.analytics.trackProductViewed({
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
});
An event triggered when a customer adds a product to their cart.
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The the product that the customer adds to their cart. |
| object | The cart the customer adds the product to. An undefined argument implies that customers may only have one cart at all times. |
Example
affirm.analytics.trackProductAdded({
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
}, {
"cartId": "CART-1234",
"name": "Main Cart"
});
An event triggered when a customer removes a product from their cart.
Parameters
Parameter | Data type | Description |
---|---|---|
| object | The product that the customer removes from their cart. |
| object | The cart the customer removes the product from. An undefined argument implies that customers may only have one cart at all times. |
Example
affirm.analytics.trackProductRemoved({
"brand": "Affirm",
"category": "Apparel",
"coupon": "SUMMER2018",
"name": "Affirm T-Shirt",
"price": 730,
"productId": "SKU-1234",
"quantity": 1,
"variant": "Black"
}, {
"cartId": "CART-1234",
"name": "Main Cart"
});
An event triggered when a customer views their cart.
Parameters
Parameter | Data type | Description |
---|---|---|
| array | The products in the cart when the customer viewed it. |
| object | The cart the customer viewed. An undefined argument implies that customers may only have one cart at all times. |
Example
affirm.analytics.trackCartViewed([{
"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"
}], {
"cartId": "CART-1234",
"name": "Main Cart"
});
Objects
Product
Represents any offered product or service.
Parameter | Description | |
---|---|---|
brand | string | The brand of the product (e.g., Affirm). |
category | string | The category the product belongs to (e.g. Apparel). |
coupon | string | Any coupon code associated with the particular instance of this product. |
name | string | The full name of the product (e.g., Affirm T-Shirt). |
price | integer | The price of the product. The value must be non-negative and represented as cents instead of dollars. |
productID | string | A unique identifier representing the product, such as the SKU or an internal database identifier used by the merchant. |
quantity | integer | The quantity of the product. The value must be non-negative. |
variant | string | The variant of the product (e.g. black). |
currency | string | A currency code associated with this product (USD) |
Cart
Represents a user’s cart. This is an optional argument for most of the functions in the Enhanced Analytics API. It is intended to support analytics for e-commerce websites that allow customers to have multiple carts.
Parameter | Data type | Description |
---|---|---|
| string | A unique identifier representing the user’s cart. |
| string | The name of the cart. |
Updated about 1 year ago