E-Commerce Tracking in GA4: The Step-by-Step Guide
E-commerce data layer, GA4 events, debugging, and enhanced conversions: the complete guide for reliable e-commerce tracking in GA4.
E-Commerce Tracking: The Foundation of Your Performance
If you sell online, your e-commerce tracking is the most critical data in your analytics stack. It feeds your revenue reports, conversion funnel analyses, campaign attributions, and ad optimizations. Poorly implemented e-commerce tracking triggers a cascade of decisions made on false data.
GA4 provides a standardized e-commerce event schema. Following it to the letter is the condition for your reports to work and for Google Ads integrations to correctly leverage your conversion data.
The Data Layer: The Technical Foundation
Everything starts with the data layer. It is a JavaScript object that your site must push at every e-commerce interaction. The data layer contains structured information (products, prices, quantities, transaction IDs) that GTM then reads and transmits to GA4.
An example for the view_item event, triggered when a user views a product page:
dataLayer.push({
event: "view_item",
ecommerce: {
currency: "EUR",
value: 49.90,
items: [{
item_id: "SKU-12345",
item_name: "Organic cotton t-shirt",
item_category: "Clothing",
item_category2: "Tops",
price: 49.90,
quantity: 1
}]
}
});
Each e-commerce event follows this structure: an event name, an ecommerce object containing the currency, total value, and an items array with product details.
Essential E-Commerce Events
GA4 defines about ten recommended e-commerce events. The five essential ones are:
view_item: product page view. Measures interest in each product and feeds dynamic remarketing audiences.
add_to_cart: cart addition. The strongest purchase intent signal before conversion.
begin_checkout: checkout initiation. Marks entry into the conversion funnel.
add_payment_info and add_shipping_info: intermediate checkout steps. Allow precise identification of where abandonments occur.
purchase: the confirmed transaction. Must contain the transaction ID, total amount, taxes, and shipping costs. This event feeds your revenue reports and Google Ads conversions.
Debugging: How to Verify Everything Works
E-commerce tracking debugging is a methodical process. Start with the GA4 DebugView Chrome extension: it displays events received by GA4 in real time with all their parameters. Verify that each event contains the correct parameters in the correct formats.
In GTM, use Preview Mode to inspect the data layer at each step of the journey. Verify that the ecommerce object is correctly structured and that values match what is displayed on the page.
Watch out for the classic trap: the cumulative data layer. If you do not push a dataLayer.push({ ecommerce: null }) before each new e-commerce push, data from the previous push can contaminate the next one. This is the most common and hardest to detect error.
Enhanced Conversions: The Next Level
Enhanced Conversions allow you to send hashed first-party data (email, phone, address) to Google at conversion time. Google uses this to improve conversion attribution, particularly for cross-device journeys.
Implementation goes through the data layer or via an automatic CSS selector in GTM. The data layer approach is more reliable: you push hashed data into the data layer at the time of purchase, and GTM sends it to Google Ads.
This is a significant lever for advertising campaigns. Google estimates that Enhanced Conversions improve conversion measurement by 5 to 15% on average.
Where to Start
If your e-commerce tracking is not yet implemented or you suspect anomalies in your conversion data, the first step is an audit of your current setup. Reliable e-commerce tracking is an investment that pays for itself on every advertising dollar spent.