Skip to content

Guide 29 · Ecommerce · GA4 + Tag Manager

Send the purchase event through Tag Manager: one GA4 Event tag and the data layer behind it

Checked 11 November 2026 · Verification: container fragment validated structurally (export format version 2, unique IDs, triggers resolve, every variable reference exists) · Steps traced to Google's developer docs and Analytics Help, opened 11 November 2026 · 6-minute read

The same purchase, sent through Tag Manager instead of gtag: the data layer push, seven data layer variables, one GA4 Event tag, and a custom event trigger on the purchase event name.

Expected signal

After step 5, Tag Assistant Preview lists the GA4 purchase tag under Tags Fired on the purchase event, and DebugView shows the same event with value 30.03, tax 4.90, shipping 5.99, and the item. After about 24 hours the order appears in the standard reports.

Download the container fragment: the purchase-event-tag-manager container fragment (JSON) (export format version 2, 6470 bytes, MD5 c9b62e35c35e3e451320c0d9ef33bc4f). It holds the GA4 Event tag, the custom event trigger, and the seven ecommerce data layer variables, with the Measurement ID left as G-XXXXXXXXXX for you to replace. The file is a hand-built import template, validated structurally — it was not exported from a live container. Import it from Admin, then Import Container, choosing Merge if the container already has tags.

What you need

  • A Tag Manager web container with the Google tag already installed. The install guide covers the container, the Google tag on the Initialization trigger, and publishing a version.
  • A data layer push from the site on the confirmation page. The site pushes the order into dataLayer in Google's ecommerce format; Tag Manager only forwards what the site pushes.
  • Editor access to the Tag Manager container and the Analytics property. Creating tags, triggers, and variables needs container access, and the DebugView check needs property access.

The trace

  1. Push the order to the data layer. On the confirmation page, the site runs dataLayer.push({ ecommerce: null }) first, to clear any earlier ecommerce object, then dataLayer.push({ event: "purchase", ecommerce: { transaction_id: "T_12345_1", value: 30.03, tax: 4.90, shipping: 5.99, currency: "USD", coupon: "SUMMER_SALE", items: [{ item_id: "SKU_12345", item_name: "Stan and Friends Tee", price: 10.01, quantity: 3 }] } }). The value is the items total: 10.01 × 3 = 30.03. Tax and shipping are separate, and 30.03 + 4.90 + 5.99 = 40.92 is the amount charged.
  2. Create the seven data layer variables. In the container, add one variable of type Data Layer Variable for each ecommerce field: ecommerce.items, ecommerce.transaction_id, ecommerce.value, ecommerce.tax, ecommerce.shipping, ecommerce.currency, and ecommerce.coupon. Name them so the tag can find them, for example DLV - ecommerce.value. These are the exact names Google's ecommerce guide uses for the purchase tag.
  3. Create the GA4 Event tag. Add a tag of type Google Analytics: GA4 Event. Set the Measurement ID to your property's ID, the Event Name to purchase, and add seven event parameters, each mapped to its variable: items to {{DLV - ecommerce.items}}, transaction_id to {{DLV - ecommerce.transaction_id}}, value to {{DLV - ecommerce.value}}, currency to {{DLV - ecommerce.currency}}, tax to {{DLV - ecommerce.tax}}, shipping to {{DLV - ecommerce.shipping}}, and coupon to {{DLV - ecommerce.coupon}}.
  4. Create the custom event trigger. Add a trigger of type Custom Event that fires when {{_event}} equals purchase. Attach it to the GA4 Event tag from step 3. The trigger matches the event name the data layer pushed in step 1, so the tag fires once per purchase push.
  5. Check it in Preview, then publish. Click Preview, connect your site in Tag Assistant, and complete a test purchase. The GA4 purchase tag must appear under Tags Fired on the purchase event. Then click Submit, choose Publish and Create Version, and publish. Preview tests the workspace draft; the live site only loads the published version.
  6. Confirm it in DebugView. In Analytics, go to Admin, then Data display, then DebugView, and look for the purchase event with value 30.03, tax 4.90, shipping 5.99, currency USD, and the item. Standard reports take about 24 hours; DebugView confirms the same minute.

Dead ends

DEAD END — THE PUSH WITHOUT THE CLEAR. If the page pushes a second ecommerce object without dataLayer.push({ ecommerce: null }) first, the new push merges with the old one, and the tag can send a purchase carrying the previous order's items. Clear first, every time.

DEAD END — THE TAG FIRES BUT THE VARIABLES ARE EMPTY. A parameter mapped to a variable that does not exist, or to a data layer key spelled differently (ecommerce.transactionId instead of ecommerce.transaction_id), sends an empty value. The tag still fires, and the purchase arrives with no transaction ID, so Analytics cannot deduplicate it. Compare the variable names against the push, character for character.

DEAD END — TWO PURCHASE SENDERS. If the site also sends purchase through gtag, or a store plugin sends it as well, the order is counted twice. Pick one sender for the purchase event and turn the others off. The transaction ID dedupes identical repeats, but it cannot fix two different senders using two different IDs.

End state

One data layer push per order, seven data layer variables, one GA4 Event tag named for the purchase event, and one custom event trigger on {{_event}} equals purchase. The worked order sends value 30.03 (10.01 × 3), tax 4.90, shipping 5.99, currency USD, coupon SUMMER_SALE, and the item, for a charged total of 40.92. The downloadable container fragment holds exactly this tag, trigger, and variable set, with the Measurement ID left as G-XXXXXXXXXX for you to replace.

Sources

Checked 11 November 2026. The tag configuration above is the one in Google's ecommerce developer guide, opened 11 November 2026, cross-checked against the container model in the Tag Manager API reference. No step was run inside a live Tag Manager container or Analytics property, because both need a Google sign-in and this site does not sign in as anyone. The container fragment was validated structurally: export format version 2, unique IDs, the tag's firing trigger resolves, every variable the tag references exists in the file, and the figures were recomputed in Python: 10.01 × 3 = 30.03, 30.03 + 4.90 + 5.99 = 40.92.