On this page
In plain English
The main ones follow the shopping journey: view_item, add_to_cart, begin_checkout, add_payment_info and purchase. Each includes an items array listing the products involved.
The purchase event needs a unique transaction_id, a value and a currency. Without the transaction ID, duplicate purchases can inflate revenue.
The usual approach is for the website to push ecommerce data to the data layer, then a GA4 Event tag in GTM sends it on. Clear the previous ecommerce object first with dataLayer.push({ ecommerce: null }) so data from one event doesn't leak into the next.
Example
On the order confirmation page, the website runs:
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: 'T-10234',
value: 129.95,
currency: 'AUD',
items: [{
item_id: 'SKU-88',
item_name: 'Coffee grinder',
price: 129.95,
quantity: 1
}]
}
});
Official documentation
- Measure ecommerce (opens in a new tab) Google for Developers
Last reviewed