CJM
PixelManual tracking

Track ecommerce events

Required and optional fields, product details, and examples for all 14 trackEcommerce events.

trackEcommerce records store actions using 14 defined event names. The exact spelling is trackEcommerce, with two “m” letters. The Pixel does not automatically extract products, prices, or orders from your website.

Before sending

  1. Install the Pixel and connect consent.
  2. Have your store developer retrieve actual product, cart, and order data.
  3. Connect each call to the action listed below. Wait for your system to confirm purchases and refunds.
  4. Send once per action and verify the result.

Signature

window.CJMPixel.trackEcommerce(eventName, data, options?)

eventName and data are required. Optional options accepts tags and destinations, documented under custom events. Meta/GTM destinations are off by default.

Fields for each event

All listed fields belong inside data. currency is required for all 14 events, even without a monetary value. Use a string such as EUR. items is an array of products, required except for refund.

EventWhen to sendRequiredOptional
view_item_listDisplay a product listcurrency, itemsitem_list_id, item_list_name
select_itemSelect a product from a listcurrency, itemsitem_list_id, item_list_name
view_itemDisplay a productcurrency, itemsvalue
add_to_cartSuccessful add to cartcurrency, itemsvalue
add_to_wishlistSuccessful add to wishlistcurrency, itemsvalue
remove_from_cartSuccessful removal from cartcurrency, itemsvalue
view_cartDisplay the cartcurrency, itemsvalue
begin_checkoutStart checkoutcurrency, itemsvalue, coupon
add_shipping_infoConfirm shipping detailscurrency, itemsvalue, coupon, shipping_tier
add_payment_infoConfirm payment methodcurrency, itemsvalue, coupon, payment_type
purchaseConfirmed purchasecurrency, transaction_id, value, itemscoupon, shipping, tax, customer_type
refundConfirmed refundcurrency, transaction_idvalue, coupon, shipping, tax, items
view_promotionDisplay a promotioncurrency, itemscreative_name, creative_slot, promotion_id, promotion_name
select_promotionSelect a promotioncurrency, itemscreative_name, creative_slot, promotion_id, promotion_name

value, shipping, and tax are numbers, not strings containing a currency symbol. Use a decimal point. Other event fields are strings; customer_type accepts only new or returning.

Use the product value for this event as value, consistent with price × quantity; specify shipping and tax separately. Do not scrape a formatted total from page text. The Pixel does not calculate totals, fill missing fields, or convert currencies.

transaction_id identifies the real order and must match for its refund. The Pixel does not prevent two purchase calls for the same order: avoid resending when the confirmation page reloads.

Every product field

Each object in items requires both item_id and item_name in the CJM contract. Optional fields receive no automatic values: supply price and quantity to describe an amount.

FieldTypeRequiredMeaning
item_idstringYesProduct code / SKU
item_namestringYesProduct name
affiliationstringNoStore or affiliation
couponstringNoItem coupon
discountnumberNoUnit discount
indexnumberNoPosition in list
item_brandstringNoBrand
item_categorystringNoMain category
item_category2, item_category3, item_category4, item_category5stringNoFurther category levels
item_list_id, item_list_namestringNoList ID and name
item_variantstringNoVariant, e.g. color or size
location_idstringNoStore location ID
pricenumberNoUnit price
quantitynumberNoQuantity
promotion_id, promotion_namestringNoPromotion ID and name
google_business_verticalstringNoBusiness vertical

Minimal examples for each event

These calls show only required fields. Choose the call for the action you are integrating; do not execute this block as a sequence. Use the complete examples below to include prices and quantities.

window.CJMPixel.trackEcommerce('view_item_list', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('select_item', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('view_item', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('add_to_cart', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('add_to_wishlist', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('remove_from_cart', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('view_cart', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('begin_checkout', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('add_shipping_info', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('add_payment_info', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('purchase', { currency: 'EUR', transaction_id: 'ORD-2026-1001', value: 89.9, items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('refund', { currency: 'EUR', transaction_id: 'ORD-2026-1001' });
window.CJMPixel.trackEcommerce('view_promotion', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });
window.CJMPixel.trackEcommerce('select_promotion', { currency: 'EUR', items: [{ item_id: 'SKU-001', item_name: 'Backpack' }] });

Examples for all 14 events

Each example is independent and includes required and optional event fields. Do not run the whole sequence on page load. Replace sample names and values with actual data.

view_item_list

window.CJMPixel.trackEcommerce('view_item_list', {
  "currency": "EUR",
  "item_list_id": "catalogo",
  "item_list_name": "Catalogo",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

select_item

window.CJMPixel.trackEcommerce('select_item', {
  "currency": "EUR",
  "item_list_id": "catalogo",
  "item_list_name": "Catalogo",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

view_item

window.CJMPixel.trackEcommerce('view_item', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

add_to_cart

window.CJMPixel.trackEcommerce('add_to_cart', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

add_to_wishlist

window.CJMPixel.trackEcommerce('add_to_wishlist', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

remove_from_cart

window.CJMPixel.trackEcommerce('remove_from_cart', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

view_cart

window.CJMPixel.trackEcommerce('view_cart', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

begin_checkout

window.CJMPixel.trackEcommerce('begin_checkout', {
  "currency": "EUR",
  "value": 89.9,
  "coupon": "WELCOME",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

add_shipping_info

window.CJMPixel.trackEcommerce('add_shipping_info', {
  "currency": "EUR",
  "value": 89.9,
  "coupon": "WELCOME",
  "shipping_tier": "Standard",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

add_payment_info

window.CJMPixel.trackEcommerce('add_payment_info', {
  "currency": "EUR",
  "value": 89.9,
  "coupon": "WELCOME",
  "payment_type": "Card",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

purchase

window.CJMPixel.trackEcommerce('purchase', {
  "currency": "EUR",
  "transaction_id": "ORD-2026-1001",
  "value": 89.9,
  "coupon": "WELCOME",
  "shipping": 5,
  "tax": 19.78,
  "customer_type": "new",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

refund

window.CJMPixel.trackEcommerce('refund', {
  "currency": "EUR",
  "transaction_id": "ORD-2026-1001",
  "value": 89.9,
  "coupon": "WELCOME",
  "shipping": 5,
  "tax": 19.78,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

view_promotion

window.CJMPixel.trackEcommerce('view_promotion', {
  "currency": "EUR",
  "creative_name": "Autumn banner",
  "creative_slot": "home_top",
  "promotion_id": "AUTUMN26",
  "promotion_name": "Autumn",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

select_promotion

window.CJMPixel.trackEcommerce('select_promotion', {
  "currency": "EUR",
  "creative_name": "Autumn banner",
  "creative_slot": "home_top",
  "promotion_id": "AUTUMN26",
  "promotion_name": "Autumn",
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "price": 89.9,
      "quantity": 1
    }
  ]
});

Product with every field

window.CJMPixel.trackEcommerce('view_item', {
  "currency": "EUR",
  "value": 89.9,
  "items": [
    {
      "item_id": "SKU-001",
      "item_name": "Zaino",
      "affiliation": "Online store",
      "coupon": "WELCOME",
      "discount": 10,
      "index": 0,
      "item_brand": "Example",
      "item_category": "Accessories",
      "item_category2": "Bags",
      "item_category3": "Backpacks",
      "item_category4": "Travel",
      "item_category5": "Cabin",
      "item_list_id": "catalogo",
      "item_list_name": "Catalogo",
      "item_variant": "Blue",
      "location_id": "MILANO-01",
      "price": 89.9,
      "quantity": 1,
      "promotion_id": "AUTUMN26",
      "promotion_name": "Autumn",
      "google_business_vertical": "retail"
    }
  ]
});

Minimal purchase and partial refund

The first example purchases two units; the second refunds only one unit from the same order. Run each call only when the corresponding operation is confirmed.

window.CJMPixel.trackEcommerce('purchase', {
  currency: 'EUR',
  transaction_id: 'ORD-2026-1002',
  value: 179.8,
  items: [{ item_id: 'SKU-001', item_name: 'Zaino', price: 89.9, quantity: 2 }]
});
window.CJMPixel.trackEcommerce('refund', {
  currency: 'EUR',
  transaction_id: 'ORD-2026-1002',
  value: 89.9,
  items: [{ item_id: 'SKU-001', item_name: 'Zaino', price: 89.9, quantity: 1 }]
});

Also send to GTM or Meta

Add options.destinations only when the destination is already available on the page. Forwarding requires all four consent signals. See Forwarding and duplicates.

Final checks

  • Use one of the 14 exact names, including lowercase letters and underscores.
  • Send actual numbers and a data object, not a JSON string.
  • For partial refunds, send only refunded products, quantities, and amounts.
  • An event named purchase sent using track() or HTML attributes is still generic. Use trackEcommerce for ecommerce formatting.
  • The TypeScript contract describes accepted fields. Pasting JavaScript does not automatically validate those types. Check your data before sending.

On this page