Appearance
Product
The product object represents a product line item that is in the cart or that has been purchased in an order.
Properties
id
- Type:
string
- Required
A unique product identifier. Used to differentiate products in the cart or order.
WARNING
Some shopping carts use the same identifier or SKU for different variants of a product. If multiple products appear with the same id
, Fanplayr will consider them identical and merge their quantities together. This can lead to undesired data being tracked so it is important that you provide a unique id
for each distinct product being tracked.
qty
- Type:
integer
- Required
The quantity of the line item in the cart or order.
sku
- Type:
string
- Required
The product SKU. This may be the same as id
, but is also made available as a segmentation option.
name
- Type:
string
- Required
The product name. E.g. "Red Shoes".
price
- Type:
float
- Required
The unit price of the product visible to the user.
For carts that implement a base price and a discounted/sale price, use the discounted price if it is the price shown to users when they add the product to the cart.
brands
- Type:
string[]
- Scope: Only applies to Product objects used in Shopping Cart and Order Confirmation pages. For Product pages, use the page-level brands property.
An array of brand names associated with the product.
Example: ["Nike"]
categories
- Type:
string[]
- Scope: Only applies to Product objects used in Shopping Cart and Order Confirmation pages. For Product pages, use the page-level categories property.
An array of category names associated with the product.
Example: ["Women", "Shoes"]
catId
- Type:
string
- Deprecated. Use categories instead.
The ID of the category that this product belongs to. Multiple categories can be specified by separating them by commas. E.g. "32,762".
catName
- Type:
string
- Deprecated. Use categories instead.
The name of the category that this product belongs to. Multiple categories can be specified by separating them by commas. E.g. "Hardwood floors,Benches".
url
- Type:
string
The URL of the page that displays full details of the product.
image
- Type:
string
The URL of the product image.
Product merging strategy
Fanplayr will not be able to track these as separate products as they share the same id
:
javascript
[
{
id: 'aygwi',
sku: 'aygwi',
name: 'Crew Tee (Black)',
price: 10.0,
qty: 1
},
{
id: 'aygwi',
sku: 'aygwi',
name: 'Crew Tee (White)',
price: 15.0,
qty: 1
}
];
Instead, Fanplayr will see these as a single product because it merges quantities of products with the same id
. This can lead to incorrect calculation of product prices and quantities.
javascript
[
{
id: 'aygwi',
sku: 'aygwi',
name: 'Crew Tee (Black)',
price: 10.0,
qty: 2
}
];
This can be avoided by providing unique identifiers for products:
javascript
[
{
id: 'aygwi-black',
sku: 'aygwi',
name: 'Crew Tee (Black)',
price: 10.0,
qty: 1
},
{
id: 'aygwi-white',
sku: 'aygwi',
name: 'Crew Tee (White)',
price: 15.0,
qty: 1
}
];