items array. Required for all product-related events.
Items Array Structure
window._upstack('track', 'purchase', {
transactionId: 'ORD-12345',
value: 149.99,
currency: 'USD',
items: [
{
id: 'SKU-001', // Product ID or SKU
name: 'Running Shoes', // Product name
price: 89.99, // Unit price
quantity: 1, // Quantity (default: 1)
brand: 'Nike', // Brand name
category: 'Footwear', // Primary category
variant: 'Blue / Size 10' // Size, color, etc.
},
{
id: 'SKU-002',
name: 'Athletic Socks',
price: 14.99,
quantity: 4,
brand: 'Nike',
category: 'Accessories'
}
]
});
Item Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | No | Product ID or SKU |
name | string | No | Product name |
price | number | No | Unit price |
quantity | number | No | Quantity (default: 1) |
value | number | No | Total value for this item (typically price × quantity) |
currency | string | No | Per-item currency override (ISO 4217 code, e.g., "USD") |
brand | string | No | Brand name |
category | string | No | Primary category |
category2 | string | No | Secondary category |
category3 | string | No | Tertiary category |
category4 | string | No | Fourth category level |
category5 | string | No | Fifth category level |
variant | string | No | Size, color, or other variant |
sku | string | No | Stock keeping unit |
discount | number | No | Discount amount per item |
coupon | string | No | Item-level coupon code |
url | string | No | Product page URL |
imageUrl | string | No | Product image URL |
content_type | string | No | "product" for individual items or "product_group" for variants |
index | number | No | Zero-based index of item in the items array |
locationId | string | No | Per-item store or location identifier |
unitCost | number | No | Cost per unit (for margin calculations) |
unitMargin | number | No | Margin per unit (for profitability tracking) |
If
value is not provided, it is computed automatically as price × quantity.Items Array by Event
// View a product
window._upstack('track', 'view_content', {
items: [{
id: 'SKU-001',
name: 'Running Shoes',
price: 89.99,
category: 'Footwear'
}]
});
// Add to cart
window._upstack('track', 'add_to_cart', {
value: 89.99,
currency: 'USD',
items: [{
id: 'SKU-001',
name: 'Running Shoes',
price: 89.99,
quantity: 1
}]
});
// Begin checkout
window._upstack('track', 'initiate_checkout', {
value: 104.98,
currency: 'USD',
items: [
{ id: 'SKU-001', name: 'Running Shoes', price: 89.99, quantity: 1 },
{ id: 'SKU-002', name: 'Athletic Socks', price: 14.99, quantity: 1 }
]
});