Skip to main content
For events involving products, use the 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

PropertyTypeRequiredDescription
idstringNoProduct ID or SKU
namestringNoProduct name
pricenumberNoUnit price
quantitynumberNoQuantity (default: 1)
valuenumberNoTotal value for this item (typically price × quantity)
currencystringNoPer-item currency override (ISO 4217 code, e.g., "USD")
brandstringNoBrand name
categorystringNoPrimary category
category2stringNoSecondary category
category3stringNoTertiary category
category4stringNoFourth category level
category5stringNoFifth category level
variantstringNoSize, color, or other variant
skustringNoStock keeping unit
discountnumberNoDiscount amount per item
couponstringNoItem-level coupon code
urlstringNoProduct page URL
imageUrlstringNoProduct image URL
content_typestringNo"product" for individual items or "product_group" for variants
indexnumberNoZero-based index of item in the items array
locationIdstringNoPer-item store or location identifier
unitCostnumberNoCost per unit (for margin calculations)
unitMarginnumberNoMargin 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 }
  ]
});