GTM Ecommerce Tracking: Set It Up Without Errors
You make GTM ecommerce tracking reliable in three steps. First, you build a clean dataLayer that exposes purchase data (product, cart, order) in a way Google Tag Manager can read. Then you send GA4 the four events that really matter: view_item, add_to_cart, begin_checkout and purchase. Finally, you test every transaction with GTM preview mode and Tag Assistant before publishing. The critical point remains purchase deduplication and wiring up Consent Mode v2, without which a share of European sales is never collected.
In brief
14 min readLevel: intermediateTools: Google Tag Manager, GA4, Tag Assistant, Google Search Console
- The dataLayer is the keystone: without it, no reliable ecommerce event reaches GA4.
- The four events to prioritize for a store are view_item, add_to_cart, begin_checkout and purchase.
- A purchase that is not deduplicated or is sent twice artificially inflates your tracked revenue: you have to test every transaction.
- GTM preview mode and the Tag Assistant extension let you validate a tag before publishing, in just a few minutes.
- On Shopify and WooCommerce, the native dataLayer is often incomplete: plan for a plugin or a server-side setup.
- Without Consent Mode v2 wired correctly, a share of transactions is simply not collected in Europe.
Contents
- What you need in place before adding a single tag
- Building a clean ecommerce dataLayer, source by source
- Setting up the key events: view_item, add_to_cart, purchase
- Managing consent with Consent Mode v2
- Checking data quality before you rely on it
- The tracking mistakes that cost the most
- Moving from installed tracking to tracking you can decide on
- Frequently asked questions
What you need in place before adding a single tag
Three building blocks are enough to get started: Google Tag Manager, a Google Analytics 4 account, and edit access to the store. Nothing more for a small business.
- StoreThe source: it announces each action through the dataLayerdrops an event
- dataLayerA conveyor belt where the store drops a package of dataGTM reads it
- Google Tag ManagerThe conductor: it reads and fires the tagssends the tag
- Google Analytics 4Receives and organizes the purchase data
Tag Manager acts as the conductor. Instead of editing the site code every time your tracking changes, everything runs through a single interface that manages all the tags. If you have never installed the container, the Google Tag Manager step-by-step for beginners covers the initial setup. GA4 receives and organizes the data. The store, for its part, is the source: it is the one that has to announce "a visitor just added this product to the cart."
What do you need: GTM, GA4 and access to the store?
The GTM container must be installed on every page. A GA4 property with its measurement ID, plus admin access to the CMS: without these three elements, no purchase data can flow.
Order matters. You install GTM first, GA4 next through GTM (not hardcoded in the theme), then you wire up the events. Putting GA4 directly in the code on top of GTM remains the most common way to double up your data. I see this double installation on a good share of the stores I open for the first time.
How does the dataLayer work in one minute?
The dataLayer is a small list of information the site publishes on every important action. Picture a conveyor belt: at each event (product view, cart addition, purchase), the store drops a package of data onto it for GTM to read.
Without this conveyor belt, GTM guesses. It can guess a button click, but not the product price, the currency or the order ID. That is where the real foundation lies: everything else depends on it. The official GA4 documentation on ecommerce measurement details the expected format for each event.
How does the dataLayer work in one minute?
| Block | Its concrete role | Common mistake |
|---|---|---|
| Google Tag Manager | Centralizes and fires the tags | Installed on only some pages |
| Google Analytics 4 | Receives and organizes the data | Installed twice (GTM + hardcoded) |
| Store access | Provides the dataLayer | Dependence on an external developer |
Building a clean ecommerce dataLayer, source by source
A clean ecommerce dataLayer exposes, for each purchase, the product details, the total amount, the currency and the unique transaction ID. These four blocks are non-negotiable.
The classic trap: believing the CMS handles everything correctly by default. Some platforms provide a native dataLayer, but it is almost always incomplete for GA4. The currency is often missing, sometimes the price excluding tax, sometimes a product ID consistent with the advertising catalog. The result: a purchase goes out, but half empty.
What should the dataLayer contain for a purchase?
For a purchase event, the dataLayer must contain at minimum: the transaction_id (unique order ID), the value (total amount), the currency (currency, EUR format), and the items array (list of products with name, ID, price and quantity). Without transaction_id, deduplication is impossible.
value and currency go together. Sending a value without a currency is like writing a price on a label without saying whether it is euros or dollars: GA4 cannot convert it, and revenue becomes unreadable. The items array then feeds all product reports and drives the link with Google Merchant Center for Shopping campaigns.
Shopify, WooCommerce, PrestaShop: where to get the product data?
The three most common CMS platforms handle the dataLayer differently, and none covers everything natively without tuning. What you actually need to plan for by platform:
Shopify, WooCommerce, PrestaShop: where to get the product data?
| Platform | Native dataLayer | What often goes missing | Common solution |
|---|---|---|---|
| Shopify | Partial (limited checkout) | Pre-order events, complete items | Dedicated app or Customer Events |
| WooCommerce | Almost absent | The entire ecommerce journey | GTM4WP extension |
| PrestaShop | Absent by default | The whole dataLayer | Third-party module or custom dev |
Shopify restricts access to the checkout funnel outside of advanced plans, which makes a reliable purchase harder. WooCommerce generally relies on the GTM4WP extension, free and solid, which pushes a GA4-compliant dataLayer. PrestaShop almost always requires a paid module or a technical intervention.
When I decide on a setup, I start by mapping what the CMS already pushes, because reinventing a dataLayer that half exists already wastes days for nothing. Setting up the tracking for a data-driven store follows the same prioritization logic.
And what about your own site?
The analysis measures speed, technical SEO and Core Web Vitals, then gives you 3 concrete recommendations. Free, no account needed.
Setting up the key events: view_item, add_to_cart, purchase
Four events are enough to steer a store: view_item (product view), add_to_cart (cart addition), begin_checkout (entering the funnel) and purchase (purchase). Trying to track everything at once is the surest way to finish nothing.

I always set them up in this order of impact. The purchase first, because it is what feeds revenue and ad decisions. The add_to_cart next: it measures real interest in a product. The begin_checkout to spot leaks in the funnel. The view_item last, useful but rarely decisive for a modest-sized store.
Setting up all seven enhanced ecommerce events from the start sinks half of these projects through sheer complexity. That is not caution, it is experience.
How do you create the trigger and the purchase tag in GTM?
You create a trigger on the custom "purchase" event pushed into the dataLayer, then a GA4 tag of type "event" named purchase, linked to the measurement ID. The trigger listens, the tag sends.
In GTM, data layer variables let you pull value, currency, transaction_id and items from the dataLayer. Each GA4 parameter points to its variable. The Google Tag Manager help center details how to create "Data Layer Variable" type variables. Once wired, a single real purchase should fire a single purchase tag, not two.
Which GA4 parameters should you never forget (value, currency, items)?
The three parameters never to forget: value (the amount), currency (the currency) and items (the product detail). A purchase missing one of the three is technically sent, but commercially useless.
- Send a unique transaction_id Without it, GA4 cannot deduplicate, and a reload of the confirmation page counts a second phantom purchase.
- Always pair value with currency An amount without a currency breaks conversion and the ROAS calculation in your campaigns.
- Fill the items array cleanly Name, ID and price per product feed the reports and the Merchant Center link.
- Align product IDs with the catalog A different
item_idbetween GA4 and Google Ads prevents dynamic retargeting. - Test before activating Ads conversions You only wire a purchase conversion to Google Ads once the
purchaseis validated.
If I had to look at only one of these five points first, it would be the transaction_id: it is what determines the reliability of everything else.
Managing consent with Consent Mode v2
Without Consent Mode v2 wired correctly, a real share of European transactions is never collected in GA4. This is not a regulatory detail. It is a direct hole in your tracked revenue.
Consent Mode v2 connects the cookie banner (the CMP) to Google Tag Manager and adjusts tag behavior based on the visitor's choice. When someone declines, Google sends anonymized signals and then models the missing conversions. But if the wiring is sloppy, no modeling makes up for it: the tags are blocked, and the matching sales vanish without a trace.
Why do my transactions disappear without consent?
Your transactions disappear because a purchase tag blocked by default, with no consent signal, simply sends nothing to GA4. The decline rate then becomes a rate of invisible sales.
The scale depends on the sector. According to the benchmark of cookie consent rates by sector, ecommerce often caps around 45% acceptance, versus 75% for media. In other words, without Consent Mode v2 to model the rest, you only see a fraction of your real sales. The CNIL sets out the French consent framework, which requires declining to be as simple as accepting.
~45%
In ecommerce, the average cookie acceptance rate leaves more than one transaction in two outside direct collection. Consent Mode v2 exists precisely to model this missing share rather than lose it.
Estimate: Lysible cookie consent benchmark
The practical wiring goes through GTM and a Google-certified CMP. The guide to setting up Consent Mode v2 without breaking GA4 or Ads details how to configure the four consent signals, step by step.
Checking data quality before you rely on it
You only trust your tracking after testing it transaction by transaction, never on the strength of a "green" tag in GTM. Preview mode and Tag Assistant are the two verification tools that matter.
GTM preview mode (Preview) opens a test session where you see, in real time, which tags fire on each action. You add a product to the cart, you watch whether add_to_cart goes out with the right parameters. You place a test order, you check that purchase sends a consistent transaction_id, value and currency. The Tag Assistant extension confirms, browser-side, what GA4 really receives. These two tools are complementary, not interchangeable.
How do you test a purchase with GTM preview mode?
You launch preview mode, you run a full purchase from start to finish, then you check in the debug panel that the purchase tag fires only once with all its parameters filled. An empty parameter signals a problem to fix before publishing, no exceptions.
I always recommend a real test purchase, refunded afterward, rather than a simulation. A genuine checkout reveals the surprises in the payment funnel that preview mode alone does not show. The same website traffic statistics to track are worth nothing if the underlying purchase is wrong.
How do you spot a double-counted purchase?
A double-counted purchase shows up when GA4 revenue exceeds that of the back office, or when the same transaction_id appears several times in the reports. The most frequent cause: the customer reloads the confirmation page, which replays the event.
Here are the seven checks to run systematically before declaring tracking reliable:
How do you spot a double-counted purchase?
| Mistake | Symptom in GA4 | Fix |
|---|---|---|
| transaction_id missing | Purchases not deduplicated | Add the ID to the dataLayer |
| purchase replayed on reload | Revenue higher than the back office | Block server-side or via cookie |
| value missing | Revenue at zero | Map the value variable |
| currency missing | Revenue not converted | Force EUR in the tag |
| items empty | Empty product reports | Fix the items array |
| GA4 installed twice | Events x2 | Remove the hardcoded tag |
| Consent not wired | Undercounted sales | Wire up Consent Mode v2 |
The tracking mistakes that cost the most
The most costly mistake is not technical. Deciding on never-verified data is what quietly burns the ad budget for months, steering on a false ROAS.

Right behind come the duplicated purchase and the unwired consent, already covered. But a subtler mistake lies in wait for growing stores: believing you should move quickly to server-side tracking because the documentation and the agencies recommend it.
Should you move to server-side tracking?
For a store whose monthly revenue stays below about €30,000, server-side tracking is most often oversized. It adds a hosting cost and a maintenance complexity rarely justified at this stage.
Server-side means routing the data through your own server before GA4, which improves resistance to blockers and data control. The HTTP Archive analyses on server container usage show real adoption, concentrated on large sites. For a modest store, the marginal gain in data does not cover the bill or the configuration time.
I only recommend moving to server-side once blocker-driven losses become measurable and genuinely weigh on media decisions. Not before. The real lever first: make browser-side tracking reliable, clean and tested. With this sound foundation in place, moving server-side becomes a logical evolution rather than a leap forward for its own sake. No business owner redoes this ongoing reliability work by hand every month: it is exactly the kind of check we have industrialized in Lysible.
23x
A misattributed euro can cost far more than its amount in wrong ad decisions repeated over several months. Reliable tracking pays off fast against the cost of a blind call.
Estimate: Lysible estimate
Moving from installed tracking to tracking you can decide on
Tracking only has value the moment it changes a decision. As long as you watch it without acting, it is a cost. The moment it tells you which product to push or which channel to cut, it is an investment.
The threshold is clear. Once your purchase data is reliable and stable over several weeks, you can finally compare channels, calculate a real acquisition cost and allocate budget without guessing. Before that threshold, every decision rests on sand. After it, the same time spent on GA4 brings in concrete euros. That is the whole point of connecting Search Console, GA4 and sales into a single reading, which Lysible centralizes for small businesses that want to decide without a permanent provider. Your next concrete step: run a test purchase this week and check that the purchase is clean.
Frequently asked questions
How do you set up GA4 ecommerce tracking with GTM?
You first install the Google Tag Manager container on every page, then you set up GA4 through GTM (never hardcoded in the theme). Next, you check that your store pushes a complete dataLayer on every purchase action. You create one trigger per event (view_item, add_to_cart, begin_checkout, purchase) and a GA4 tag linked to your measurement ID, which reads value, currency, transaction_id and items from the dataLayer. Finally, you test each event in preview mode before publishing. Order matters: container, then GA4, then events, then tests.
What is a dataLayer and what is it for?
The dataLayer is a list of information your site publishes on every important action, like a conveyor belt that drops packages of data for GTM to read. For a purchase, it contains the product details, the amount, the currency and the order ID. Without it, GTM can detect a click but not the price or the currency: calculating real revenue becomes impossible. It is the foundation of any reliable ecommerce tracking. An incomplete dataLayer produces events that are sent but unusable, which skews all of your reports.
How do you send the purchase event to GA4 through GTM?
In GTM you create a trigger that listens for the "purchase" event pushed into the dataLayer on your confirmation page. You then create a GA4 event-type tag, named purchase, linked to your measurement ID. This tag pulls value, currency, transaction_id and items through data layer variables. You test in preview mode with a real purchase, checking that the tag fires only once with all its parameters filled. You publish only after this check, then you optionally wire up the Google Ads conversion.
Why don't my sales show up in GA4?
Three causes dominate. First, an absent or incomplete dataLayer: the purchase tag goes out empty or does not go out at all. Second, a badly wired Consent Mode v2: visitors who decline cookies are neither collected nor modeled, which can be the majority of them in ecommerce. Third, a badly triggered or unpublished tag. Check in preview mode that a test purchase indeed fires purchase with value, currency and transaction_id. Then compare GA4 revenue to your back office: a large gap always signals a configuration problem to fix.
How do you avoid purchases being counted twice?
Always send a unique transaction_id per order in the dataLayer: GA4 uses it to automatically deduplicate identical purchases. The most frequent cause of double counting is the reload of the confirmation page, which replays the purchase event. To neutralize it, you can block the second send via a cookie, a session variable, or server-side. Spot the problem by comparing your GA4 revenue to your back office: if it is higher, you are probably counting phantom purchases. Test several real transactions before considering the tracking reliable.
Does GTM ecommerce tracking work on Shopify and WooCommerce?
Yes, but not with the same ease. On WooCommerce, the free GTM4WP extension pushes a GA4-compliant dataLayer and covers the whole purchase journey. On Shopify, access to the checkout funnel is restricted outside advanced plans, which makes a reliable purchase harder: you often have to go through Customer Events or a dedicated app. PrestaShop almost always requires a third-party module or a technical intervention, because it pushes nothing by default. In all three cases, the principle stays the same: map what the CMS already provides, then complete the missing dataLayer before configuring the tags.


