Sub topic 4
Item parameters: IDs, names, prices, quantities, and categories
Assume you understand GA4 properties, basic JavaScript objects and arrays, and how a shop stores product and order data. This chapter focuses on the fields inside the items array. These fields describe each product in an e-commerce event such as view_item, add_to_cart, or purchase.
How an item is identified
An item is one product entry in the items array. Give every product a stable item_id from your catalog, such as a SKU or database product ID. Use the same ID across discovery, cart, checkout, purchase, and refund events.
item_name is the human-readable product name. Send it even when you use item_id, because reports and debugging are easier to understand. At least one of item_id or item_name should identify the item, but sending both is the usual practice.
| Parameter | Purpose | Example |
|---|---|---|
| `item_id` | Stable catalog or SKU identifier | `SKU_1001` |
| `item_name` | Product name shown to users | `Trail Running Shoe` |
| `item_brand` | Product brand | `Acme` |
| `item_variant` | Distinguishing option | `blue / size 10` |
| `item_category` | Primary category | `Shoes` |
| `item_category2` through `item_category5` | Deeper category levels | `Running` |
Prices, quantities, and discounts
price is the unit price for one item. quantity is the number of units represented by that item entry. For two shoes costing $24.99 each, send price: 24.99 and quantity: 2. Do not send the line total as price.
Use numeric values, not formatted strings such as "$24.99". If a discount applies, send the per-unit discount in discount. Send a coupon code in coupon when the discount comes from a coupon.
gtag('event', 'add_to_cart', {
currency: 'USD',
value: 49.98,
items: [
{
item_id: 'SKU_1001',
item_name: 'Trail Running Shoe',
item_brand: 'Acme',
item_category: 'Shoes',
item_category2: 'Running',
item_variant: 'blue / size 10',
price: 24.99,
quantity: 2,
discount: 5.00
}
]
});The event-level value should represent the value used for that event. Keep item-level fields consistent with the source system. For a purchase, calculate the total from the order record rather than from a browser display value.
Model the item hierarchy
Use item_category for the broadest category and the numbered fields for narrower levels. For example, Shoes → Running → Trail can use item_category, item_category2, and item_category3. Do not place the full hierarchy into one field if you need separate category analysis.
Exercise
A customer buys three units of a product at 12.50 USD each. Which item fields should represent this line?
Show answer
Send price: 12.50 and quantity: 3. The line value is 37.50, while price remains the per-unit amount.