Sub topic 4
Item parameters in ecommerce events
Assume you know that GA4 collects events and that you can send events with gtag.js or Google Tag Manager. This chapter focuses on ecommerce items: the individual products or services associated with an event.
What an item parameter describes
An ecommerce event can contain an items array. An array is a list of values. Each value in this array is an item object that describes one product.
For example, a view_item event might describe one shoe. A purchase event might contain several item objects, one for each product in the order.
GA4 provides recommended item parameters such as item_id, item_name, item_brand, item_category, price, and quantity. You can also send your own item parameters. A custom item parameter describes an attribute that GA4 does not provide by default, such as color, material, membership level, or delivery method.
gtag('event', 'view_item', {
currency: 'USD',
value: 29.99,
items: [{
item_id: 'SKU_123',
item_name: 'Trail Shoe',
item_color: 'green'
}]
});Here, item_color belongs to the item object. It is not an event parameter that describes the whole view_item event. If the event contains five products, each product can have a different item_color.
Item scope versus event scope
The scope of a custom dimension determines what one value describes.
| Scope | Value describes | Example |
|---|---|---|
| Event | The event as a whole | `shipping_method: "express"` |
| User | A user across events | `customer_type: "subscriber"` |
| Item | One product in an ecommerce event | `item_color: "green"` |
Use item scope when the value can differ between items in the same event. For example, a purchase can contain a green shoe and a blue jacket. Sending one event-scoped item_color would lose that distinction.
Use event scope for values that apply to the entire action. An order's payment method or shipping method belongs at event scope, even though the event also contains items.
How item parameters appear in GA4
Sending an item parameter does not automatically create a report field. First, send the parameter in the correct item object. Then verify that the value arrives. Finally, register it in GA4 as an item-scoped custom dimension.
In the GA4 interface, open Admin, choose Custom definitions, and create a custom dimension. Select Item as the scope and enter the item parameter name, such as item_color. Use a clear display name, such as Item color.
The registration describes how GA4 should expose the data. It does not move an event-scoped value into item scope, and it does not repair an incorrectly shaped items array.
Common errors
- Putting
item_colorbesideitemsinstead of inside each item object. - Using the same event-scoped parameter for products that have different values.
- Omitting a stable
item_id, which makes item analysis harder. - Changing the meaning of
item_colorover time. For example, do not use it for both product color and a marketing color label. - Expecting values sent before registration to appear in standard reports. Custom definition registration is generally not retroactive.
Use the same parameter name and value format everywhere. If the site sends green, do not send Green, GREEN, and forest interchangeably unless those are intentionally different categories.
Exercise
A purchase contains a red shirt and a blue shirt. Should color be sent as an event-scoped parameter or as an item parameter?
Show answer
Send color inside each item object and register it as an item-scoped custom dimension, because the value differs between items in the same purchase.