---
title: "GA4 ecommerce guide: DataLayer and Google Tag Manager"
description: "A manual for measuring a store in GA4: what the data layer is, which events to send at each stage, how to validate them and where to go next on each topic."
url: "https://cookingmetrics.com/blog/guia-ga4-ecommerce-datalayer-gtm/"
markdown_url: "https://cookingmetrics.com/blog/guia-ga4-ecommerce-datalayer-gtm.md"
lang: "en"
date_published: "2026-12-03"
author: "Martín Garay"
author_url: "https://cookingmetrics.com/about-martin-garay/"
publisher: "CookingMetrics"
publisher_url: "https://cookingmetrics.com/"
keywords: ["Google Analytics", "Google Tag Manager", "MarTech"]
citation_apa7: "Garay, M. (2026, December 3). *GA4 ecommerce guide: DataLayer and Google Tag Manager*. CookingMetrics. https://cookingmetrics.com/blog/guia-ga4-ecommerce-datalayer-gtm/"
references_apa7:
  - "Google Analytics Developers. (n.d.). *Recommended events (reference)*. https://developers.google.com/analytics/devguides/collection/ga4/reference/events"
  - "Google Analytics Developers. (n.d.). *Measure ecommerce*. https://developers.google.com/analytics/devguides/collection/ga4/ecommerce"
  - "Google Analytics Help. (n.d.). *Recommended events*. https://support.google.com/analytics/answer/9267735"
---

# GA4 ecommerce guide: DataLayer and Google Tag Manager

> A manual for measuring a store in GA4: what the data layer is, which events to send at each stage, how to validate them and where to go next on each topic.

- **Author:** [Martín Garay](https://cookingmetrics.com/about-martin-garay/) · Founder of CookingMetrics
- **Published:** December 3, 2026
- **Topics:** Google Analytics, Google Tag Manager, MarTech
- **Web version:** https://cookingmetrics.com/blog/guia-ga4-ecommerce-datalayer-gtm/

## How to cite this article (APA, 7th edition)

Garay, M. (2026, December 3). *GA4 ecommerce guide: DataLayer and Google Tag Manager*. CookingMetrics. https://cookingmetrics.com/blog/guia-ga4-ecommerce-datalayer-gtm/

In-text citation: (Garay, 2026)

## References

- Google Analytics Developers. (n.d.). *Recommended events (reference)*. https://developers.google.com/analytics/devguides/collection/ga4/reference/events
  In-text citation: (Google Analytics Developers, n.d.)
- Google Analytics Developers. (n.d.). *Measure ecommerce*. https://developers.google.com/analytics/devguides/collection/ga4/ecommerce
  In-text citation: (Google Analytics Developers, n.d.)
- Google Analytics Help. (n.d.). *Recommended events*. https://support.google.com/analytics/answer/9267735
  In-text citation: (Google Analytics Help, n.d.)

---

**Measuring a store in GA4 means the site publishes, in a data layer, one event for each step of the purchase journey, with the correct products and amounts, and Google Tag Manager sends them to GA4.** This guide is the map; each topic has its own article.

It is written for those who decide what to measure, not only for those who implement it. Technical terms are explained in plain words and the detail appears under the label "For the technical team". [CookingMetrics](https://cookingmetrics.com/) offers audits and support to development teams and does not sell tools or implement stores. A warning: the Google pages consulted on November 16, 2026 show no update date; it is worth rereading them before implementing.

## In summary

- The **data layer** (dataLayer) is a list of messages that the site prepares and that Google Tag Manager reads in order to send them to GA4.
- Each step of the journey has an event: viewing a list, choosing a product, viewing it, adding it, paying, buying.
- Products travel in a list called `items`; amounts need a currency.
- Event and parameter names must be Google's. If they are invented, some reports do not recognize them.
- Events are validated before publishing and audited from time to time: a badly sent event does not produce an error, it produces false data.
- This guide does not promise that measuring better will increase sales; it lets you know what is happening.

## What problem it solves

Without measuring the journey, a store knows how much it sold but not where people drop off: on the home page, on the product page, in the listing, in the search or at payment. GA4 can show that journey if the site hands it the right events. Measuring it well is a business and product decision before a technical one: what you want to know, from which pages, and who is responsible for keeping the data correct.

## The journey and its events

An event is a message that signals that something happened: "a person viewed this product". These are the GA4 commerce events according to the official documentation, grouped by stage, with the article where each one is developed:

- **Home page and banners:** `view_promotion` and `select_promotion`. See [Measuring the home page and banners](https://cookingmetrics.com/blog/medir-home-banners-ga4-promociones/).
- **Category listings:** `view_item_list` and `select_item`. See [Measuring product listings](https://cookingmetrics.com/blog/medir-plp-ga4-view-item-list-select-item/).
- **Internal search:** `search`. See [Measuring internal search](https://cookingmetrics.com/blog/medir-buscador-interno-ga4-search/).
- **Product page:** `view_item`, `add_to_cart`, `remove_from_cart` and `add_to_wishlist`. See [Measuring the product page](https://cookingmetrics.com/blog/medir-pdp-ga4-view-item-add-to-cart/).
- **Cart and payment:** `view_cart`, `begin_checkout`, `add_shipping_info`, `add_payment_info`, `purchase` and `refund`. See [Measuring the checkout process](https://cookingmetrics.com/blog/medir-proceso-de-pago-ga4-checkout/).

You do not need to implement them all at once. A reasonable order, and it is our own criterion, is to start with `purchase` and the payment steps, because without them there is no revenue to look at, and then work backward to the product page, the listing and the home page.

## What data each event carries

Almost all commerce events carry a list of products (`items`) and, if there are amounts, the currency (`currency`) and the value (`value`). According to Google ([reference](https://developers.google.com/analytics/devguides/collection/ga4/reference/events)), `currency` is required if `value` is sent. Each product needs at least an identifier or a name; Google recommends sending both. The price (`price`) is the unit price with the discount already applied, and the discount goes separately in `discount`.

A decision maker does not need to memorize parameters; they do need to know that **every missing piece of data is a gap in a report**. If the site does not send the product category, GA4 cannot show sales by category.

## How events reach GA4

The site publishes the event in the data layer and Google Tag Manager sends it to GA4. There is another way, sending the event directly with `gtag.js`. In his guide, Martín Garay prefers the data layer with Tag Manager, and it is a matter of judgment, not a requirement: the advantage is that the development team and the analytics team agree on a data contract, and changing a tag does not force you to touch the site's code.

**For the technical team:** a minimal example of an event published in the data layer.

```
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push({
  event: "view_item",
  ecommerce: {
    currency: "USD",
    value: 40.0,
    items: [{ item_id: "SKU-001", item_name: "Taza de cerámica", price: 40.0, quantity: 1 }]
  }
});
```

- The first `push` line clears the previous `ecommerce` object. It is a widespread practice so that data from one event is not mixed with data from the previous one; we did not find it in the official pages consulted.
- In Tag Manager, a common approach is one trigger per event and one GA4 event tag that reads `ecommerce` from the data layer.
- Event and parameter names must be exactly Google's.
- The data layer should be declared before the Tag Manager container loads.

## How to validate

Before publishing, go through the store as a customer would and check, event by event, that it is sent, that it carries the correct products and that the amounts add up. Martín Garay's original guide uses two Chrome extensions for this: Tag Assistant Companion and Simple Data Layer Viewer. After publishing, compare the `purchase` total in GA4 with that of the store's order system: they may not match exactly, but a large difference indicates a problem.

**For the technical team:** check that `transaction_id` is unique, that `value` is the sum of price times quantity without shipping or taxes, that `currency` is always present and that there are no duplicate events caused by page reloads.

## A detail Google does not define: the index

In listings, each product can carry an `index` with its position. Google describes it as the position of the product in a list and does not say whether it is counted from 0 or from 1; its code examples use both. Choose a base, document it and use it in all lists, or position reports will not be comparable.

## Limits and risks

- **There is no guarantee of results.** Measuring well does not increase sales by itself.
- **A measurement error gives no warning.** A misspelled parameter does not produce a visible error; it produces an incomplete report.
- **The official pages have no date.** It is worth rereading them before implementing.
- **This guide does not replace an audit.** Each store has its own platform, its own checkout flow and its own exceptions.
- **Consent and privacy:** what can be measured depends on the visitor's consent and on the applicable regulations; this guide does not cover them.

## What to do next

Choose a single stage of the journey, the one that raises the most questions for you today, and read its article. If you would like us to review with your team what is measured today and what data is missing, see our [Google Analytics audit service](https://cookingmetrics.com/data-analytics-consulting/): we audit and support, and we do not implement stores or sell tools.

## Frequently asked questions

### What is the data layer (dataLayer)?

It is a list of messages that the site prepares and that Google Tag Manager reads in order to send them to GA4. It lets the site and analytics agree on what is measured.

### Do I have to implement all the ecommerce events?

No. It is best to start with the purchase and the payment steps, and work backward to the product page, the listing and the home page according to what you need to know.

### Can I use my own event names?

For commerce events, use Google's names. With custom names, some commerce reports do not recognize them. For particular needs, additional events can be defined.

### How do I know if my measurement is correct?

Go through the store and check each event with debugging tools, and compare the purchases in GA4 with those in the order system. A large difference indicates a problem.

---

## About the author

**[Martín Garay](https://cookingmetrics.com/about-martin-garay/)** — Founder of CookingMetrics

I'm Martín Garay, founder and Martech Advisor at CookingMetrics and Chair of the Technology Committee at CACE, Argentina's ecommerce chamber. For more than 20 years I've worked in Analytics, development, technical SEO and ecommerce: I implement measurement, find where it breaks and turn it into information you can act on.

### My work at CACE, Argentina's ecommerce chamber

- **Chair of the Technology Committee** (SINCE AUGUST 2025): I set the committee's agenda together with Gabriel Topola, vice-chair. We look at the platforms and tools an online business needs to grow: CMS, integrations, customer service and omnichannel operations.
- **Curating the technical forum** (IT CAMP · ECOMMERCE DAY ARGENTINA): With CACE's Events team I put together the IT Camp programme: talks for engineering and development teams on platform architecture, code and good practice, given by speakers who do the implementation work.
- **Marketing and Data Analytics committees** (SINCE 2016): I started in the Marketing committee and helped create the Data Analytics committee. I gave Google Analytics webinars, including the migration to GA4, and worked on the Google Analytics implementation for Hot Sale and Cyber Monday.
- **Ecommerce metrics dashboard** (FOR MEMBERS): With the Data Analytics committee and the CACE Community team we built a dashboard in Google Analytics and Looker Studio so each member can check the key indicators of their own store.

### Talks

- [From SEO to GEO: what it takes for a brand to be cited by an answer engine](https://www.youtube.com/watch?v=mlyjuSBdMzI) — ECOMMERCE DAY ARGENTINA 2026 · IT CAMP · AUGUST 27, 2026 · BUENOS AIRES CONVENTION CENTER
- [SEO for AI: how to prepare a brand to show up in ChatGPT and Google's AI overviews](https://www.youtube.com/watch?v=4dI7jqnLg-M) — AI IN LATAM 2025 · BUENOS AIRES · OVER 3,500 ATTENDEES AND 100 SPEAKERS, PER THE ORGANIZERS

### Profiles and links

- [Full profile](https://cookingmetrics.com/about-martin-garay/)
- [LinkedIn](https://www.linkedin.com/in/seospecialistmartingaray/)
- [Instagram](https://www.instagram.com/garaymartin/)
- [YouTube](https://www.youtube.com/@MartinGaray)
- [martingaray.com.ar](https://www.martingaray.com.ar/)
- [Chair of the Technology Committee at CACE, Argentina's ecommerce chamber](https://cace.org.ar/pages/comision-de-tecnologia?utm_source=cookingmetrics.com&utm_medium=referral&utm_campaign=perfil-martin&utm_content=caja-autor)
- [Ecommerce metrics dashboard, free for CACE members](https://cace.org.ar/pages/dashboard-de-metricas?utm_source=cookingmetrics.com&utm_medium=referral&utm_campaign=perfil-martin&utm_content=caja-autor)

---

## About CookingMetrics

CookingMetrics provides Google Analytics consulting, measurement implementation and SEO. Founder Martín Garay brings more than 20 years of experience in Analytics, development and ecommerce. The work connects data with business decisions.

### Services

- **[Google Analytics audit](https://cookingmetrics.com/data-analytics-consulting/)**: Do purchases or revenue differ from your store? We review your measurement and deliver a correction plan in 10 business days. [See the audit scope](https://cookingmetrics.com/data-analytics-consulting/).
- **[Google Tag Manager](https://cookingmetrics.com/services/gtm/)**: Did events stop being tracked after a website change? We review tags, triggers and versions to find duplicates or missing data. [Ask about Google Tag Manager audits and implementation](https://cookingmetrics.com/services/gtm/).
- **[Server-side measurement](https://cookingmetrics.com/services/cookieless-tracking/)**: We assess how to send data from your server, respect consent and prevent duplication. [What's included in server-side measurement](https://cookingmetrics.com/services/cookieless-tracking/).
- **[Technical SEO](https://cookingmetrics.com/services/technical-seo/)**: Have you migrated your site, or are pages missing from Google? We review crawling, indexing, structure and performance. [How we approach technical SEO](https://cookingmetrics.com/services/technical-seo/).
- **[SEO for AI search (GEO)](https://cookingmetrics.com/services/seo-ai-geo/)**: We review whether search engines and assistants can access your pages and understand their content. [What we can improve for AI search](https://cookingmetrics.com/services/seo-ai-geo/).

**Let's talk about your measurement:** [Contact us](https://cookingmetrics.com/about-martin-garay/) · [CookingMetrics](https://cookingmetrics.com/)
