π΄ Phase 1 β CoreΒ Β·Β Click-tracking from product lists.
select_item
When to pushβ
When the user clicks a product card in a list, before navigating to the PDP.
Exampleβ
function onProductCardClick(product, listId, listName, position) {
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push({
event: 'select_item',
ecommerce: {
item_list_id: listId,
item_list_name: listName,
items: [
{
item_id: product.sku,
item_name: product.name,
item_brand: 'Biosphere',
item_category: product.category,
item_variant: product.variant,
price: product.price,
index: position,
quantity: 1
}
]
}
});
window.location.href = product.url;
}
Parametersβ
| Parameter | Required |
|---|---|
item_list_id | recommended |
item_list_name | recommended |
items (1 item, the clicked one) | required |
index should match the one in the preceding view_item_list.
Platformsβ
| Platform | Native event |
|---|---|
| GA4 | select_item |
| Meta | β |
| Google Ads | β |
Pitfallsβ
- β Pushing multiple items β only the clicked one.
- β Navigating before pushing β event lost. Push, then navigate (push is synchronous).