GTM ecommerce tracking works best when the site pushes one GA4-format event per funnel step (view_item, add_to_cart, begin_checkout, add_payment_info, purchase) with items, value and currency, plus a transaction_id and an event_id on purchase. Clear the previous ecommerce object before each push. In GTM, one Custom Event trigger per step feeds the GA4, Meta, TikTok and Snap tags from the same variables.
- Push after the action succeeds, never on the button click alone.
- value is a number; currency is required when you send value.
- Keep one item ID (the catalog SKU) from product page to purchase.
- Fire purchase once per order, even if the buyer reloads or returns in a new tab.
The usual way ecommerce tracking breaks is not GTM. It is a site that pushes different shapes at each step, a purchase that fires before payment, or an item ID that changes between the product page and the cart. If the dataLayer is clean, the GTM side is mostly copying the same trigger and variables into four tags.
The ecommerce events, step by step
Funnel steps, parameters and platform names
| Push when | Parameters | Meta | TikTok | Snap | |
|---|---|---|---|---|---|
| view_item | The product page has loaded | currency, value, items | ViewContent | ViewContent | VIEW_CONTENT |
| add_to_cart | The cart confirms the add | currency, value, items | AddToCart | AddToCart | ADD_CART |
| begin_checkout | Checkout opens | currency, value, items, coupon | InitiateCheckout | InitiateCheckout | START_CHECKOUT |
| add_payment_info | A payment method is chosen | currency, value, payment_type, items | AddPaymentInfo | AddPaymentInfo | ADD_BILLING |
| purchase | Payment is confirmed | transaction_id, currency, value, tax, shipping, items, event_id | Purchase | Purchase | PURCHASE |
Google’s list has more steps (view_item_list, select_item, view_cart, remove_from_cart, add_shipping_info, refund and the promotion events), and they are worth adding for GA4 reports. For the ad platforms, the five above carry the optimization. Each item needs item_id or item_name; send both, plus price and quantity.
One sample purchase push
This is the shape to hand your developer. The first line clears the previous ecommerce object, which is what Google’s GA4 ecommerce guide does before every push, so values from an earlier step don’t leak into this one.
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null }); // clear the previous ecommerce object
dataLayer.push({
event: 'purchase',
event_id: 'ord-10482-purchase', // one ID per event; the server reuses it
ecommerce: {
transaction_id: '10482', // the order ID, never empty
value: 249.00, // number: price x quantity, no tax or shipping
currency: 'USD',
tax: 12.45,
shipping: 15.00,
coupon: 'WINTER10',
items: [{
item_id: 'SKU-123', // the same ID as in your product catalog
item_name: 'Running shoe',
item_category: 'Shoes',
price: 124.50,
quantity: 2
}]
}
}); Reuse one push for every platform
Wire one ecommerce push to GA4, Meta, TikTok and Snap in GTM
Build once, then copy the trigger and variables into each platform’s tag.
- 01
Create one trigger per step
Custom Event triggers named after each event: purchase, add_to_cart and so on.
- 02
Create the shared variables
Data Layer Variables for ecommerce.transaction_id, ecommerce.value, ecommerce.currency, ecommerce.items and event_id.
- 03
GA4
A Google Analytics: GA4 Event tag with Event Name set to {{Event}}. Under More Settings, Ecommerce, tick Send Ecommerce data with Data Source set to Data Layer. Attach all five triggers.
- 04
Meta
The Meta Pixel template reads the latest ecommerce object for content and value. Set the event name per tag and Event ID to {{DLV - event_id}}.
- 05
TikTok
The TikTok Pixel template can read GA4 ecommerce dataLayers for product properties. Set Event ID to the same variable.
- 06
Snap
Map price from value, currency, item IDs and number of items, transaction ID on PURCHASE, and Client Deduplication ID from event_id.
- 07
Test the full path
In Preview, buy something with a test payment, and check each tag fired once with the same transaction ID and event ID.
Event IDs and dedup rules per platform are in Meta Pixel and Conversions API in GTM and TikTok and Snap pixels in GTM.
transaction_id: the field that stops double purchases
In GA4, the transaction ID is what lets Google Analytics deduplicate repeat purchases from the same user. Google warns against sending an empty string, because every purchase with transaction_id set to empty is deduplicated together. In Google Ads, a second conversion with the same conversion action and transaction ID is dropped. Snap matches the Pixel’s transaction_id to the server’s order_id for purchases. One field, used three ways, so it must be the real order ID and never blank.
Ask the developer to record that an order’s purchase was sent, in localStorage keyed by order ID, and skip the push if it was. sessionStorage is not enough: payment gateways often return the buyer in a new tab, which starts a fresh session.
If GA4 already shows duplicate transactions, GA4 duplicate purchases walks through finding the cause.
Where this goes wrong
- Purchase fires before payment. Some sites push purchase when the order is created, then send the buyer to a payment page they may abandon. Push on the confirmation page, after the payment status is checked.
- Online payments never come back. Card and instalment payments that redirect to an external gateway and never return to a tracked page leave only cash orders tracked. Ask for a return URL that confirms payment.
- Item IDs that change. A SKU on the product page, an internal number in the cart, and a number instead of a string at checkout break catalog matching. One ID, one type, everywhere.
- Stale values. Without the ecommerce: null line, a variable can read the previous step’s items.
- Text values and the wrong currency. "249,00 USD" is text. Local-currency amounts labelled as USD inflate revenue.
- A store app and GTM both sending purchase. A platform plugin and your GTM tags can both send the same purchase. Pick one source per platform.
Do it faster with Whathead
With Whathead’s Google Tag Manager MCP, Claude can read your container and tell you which ecommerce events each platform receives, which tags lack a transaction ID or event ID, and then build the missing triggers, variables and tags in a workspace. The GA4 MCP can run a funnel report afterwards to see whether each step is arriving. Whathead is our product.
- “In GTM-XXXXXXX, make a table of the ecommerce events (view_item to purchase) and which GA4, Meta, TikTok and Snap tags fire on each. Mark gaps and any tag without a transaction ID or event ID.”
- “Create Custom Event triggers for the five ecommerce events and Data Layer Variables for transaction_id, value, currency, items and event_id. Don’t publish; list the workspace changes.”
Before anything changes, Claude asks you to approve each GTM write. There is no dry-run preview for GTM; the workspace holds the changes until you test them in Preview and publish a version.
GTM ecommerce tracking: common questions
How do I set up ecommerce tracking in GTM for GA4?
Have the site push GA4 ecommerce events to the dataLayer, create a Custom Event trigger for each, and add a GA4 Event tag with Send Ecommerce data enabled and Data Source set to Data Layer.
Why clear the ecommerce object before each push?
So values from an earlier push, such as items from a product list, don’t carry into the next event. Google’s GA4 ecommerce guide pushes ecommerce: null before each event.
Why is my GA4 purchase firing twice?
Common causes are a reload of the confirmation page, a gateway returning in a new tab, or a plugin and GTM both sending it. A real transaction ID lets GA4 deduplicate repeats from the same user.
Can one dataLayer push feed GA4 and the Meta Pixel?
Yes. The same Custom Event trigger and variables can fire GA4, Meta, TikTok and Snap tags; only the event names and field names differ per platform.
Do I need a developer for ecommerce tracking?
For the dataLayer pushes, yes, or a platform plugin that writes them. The GTM side can be built by a marketer once the pushes are reliable.
Sources
- Google developers: GA4 ecommerce, Tag Manager tab, GA4 recommended events, Data layer. Checked 19 Nov 2026.
- GA4 Help: Transaction IDs and duplicate purchases. Google Ads Help: Transaction IDs. Checked 19 Nov 2026.
- Platforms: Meta Pixel reference, Meta Pixel GTM template, TikTok standard events, TikTok Pixel GTM template, Snap deduplication, Snap Pixel GTM template. Checked 19 Nov 2026.
Written by Ahmed Shahin, founder of Whathead. Last reviewed 19 November 2026.
Map your ecommerce tags in one read
See which ecommerce events reach GA4, Meta, TikTok and Snap, and which tags are missing a transaction ID, from Claude.



