Skip to content

Guide 28 · Ecommerce · GA4 + Tag Manager

Send the purchase event with gtag.js: the order, the parameters, and the DebugView check

Checked 11 November 2026 · Verification: reference file checked in Python (figures recomputed from the worked example) · Steps traced to Google's developer docs and Analytics Help, opened 11 November 2026 · 6-minute read

Google's own purchase tutorial, traced step by step: the gtag call on the confirmation page, the transaction ID that stops double counting, and the DebugView check that proves it arrived.

Expected signal

After step 5, the purchase event shows in DebugView with transaction_id T_12345_1, value 30.03, tax 4.90, shipping 5.99, and the item in the items array. After about 24 hours, the same order appears in the standard reports with item revenue 30.03, total revenue 30.03, and ecommerce purchases 1.

Download the reference: the purchase-event-gtag reference (JSON) (1734 bytes, MD5 08028632f3219ad7e518d3dab47a46a1). It holds the event parameters, the worked example, and the recomputed figures.

What you need

  • A Google Analytics account and property, with a web data stream for the site. The stream is where the Measurement ID lives. The install guide covers the property, the stream, and the Google tag that has to be on the site first.
  • Access to the website source code. The purchase event goes on the page where someone makes a purchase, in a script tag at the end of the body.
  • The Editor role or above on the Analytics account. Google's tutorial lists this as a prerequisite, and the DebugView check needs a signed-in account with access to the property.
  • The order values for one real order. The worked order here is Google's own: three Stan and Friends Tees at 10.01 each, tax 4.90, shipping 5.99, currency USD.

The trace

  1. Confirm the Google tag is on the site. The purchase event is sent through the Google tag, so the tag has to be installed before anything here works. The tag ID is the Measurement ID from the web data stream, starting with G-. If the tag is not on the site, follow the install guide first; this guide does not repeat it.
  2. Add the purchase event to the confirmation page. Place the event in a <script> tag at the end of the <body>, so it runs when the confirmation page loads. The call is gtag("event", "purchase", { 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 parameters, not part of value. The amount the customer was charged is 30.03 + 4.90 + 5.99 = 40.92.
  3. Or fire it from the Purchase button instead. Give the button an ID, then wrap the same gtag call in a click listener, so the event sends only when someone clicks Purchase. Google's tutorial uses a different transaction ID for the button version, T_12345_2, so Analytics does not treat the two test sends as the same order. Every real order needs its own transaction ID; reusing one makes Analytics drop the repeat as a duplicate.
  4. Turn on debug mode. Add 'debug_mode': true to the config command: gtag('config', 'TAG_ID', { 'debug_mode': true }). Debug mode sends the event to DebugView, where you can see it in real time instead of waiting for standard reports.
  5. Check it in DebugView. In Analytics, go to Admin, then Data display, then DebugView. Trigger the purchase, then select the event in DebugView to see its parameters, user properties, and items. The value must read 30.03, the currency USD, and the items array must hold the tee with price 10.01 and quantity 3. If a parameter is missing here, it will be missing in the reports too.
  6. Wait about 24 hours for the standard reports. After about 24 hours the purchase data becomes available in reports, explorations, and the Analytics Data API. Google's tutorial states what one click of the Purchase button populates: item revenue 30.03, total revenue 30.03, and ecommerce purchases 1. Check those three numbers against the order in your own store system.

Dead ends

DEAD END — THE SAME TRANSACTION ID ON TWO ORDERS. Analytics deduplicates on transaction_id. That is the point of the ID: a reloaded confirmation page does not count twice. But if your checkout reuses an ID for a second real order, the second order disappears from revenue. Give every order a fresh ID from your order system, never a fixed string in the code.

DEAD END — VALUE SENT AS TEXT. value: "30.03" with quotes is a string, and Analytics needs a number. Revenue metrics stay at zero while the event itself looks fine in DebugView. Send the number without quotes, and send currency with it, or revenue is computed wrong.

DEAD END — LOOKING FOR THE PURCHASE IN STANDARD REPORTS THE SAME HOUR. Standard reports can take about 24 hours to process the data. A purchase that is absent from the Monetization reports an hour after the order is usually not missing; it is still processing. The same-hour check belongs in DebugView, not in a standard report.

End state

The confirmation page sends one purchase event per order, with a unique transaction_id, a numeric value equal to the items total (10.01 × 3 = 30.03), tax 4.90 and shipping 5.99 as their own parameters, currency USD, and the items array. The order total is 40.92. DebugView shows the event the same minute, and the standard reports show item revenue 30.03, total revenue 30.03, and ecommerce purchases 1 after about 24 hours.

Sources

Checked 11 November 2026. The click paths above are the ones in Google's developer tutorial, opened 11 November 2026. No step was run inside a live Analytics property, because that needs a Google sign-in and this site does not sign in as anyone. The figures were recomputed in Python: 10.01 × 3 = 30.03, 30.03 + 4.90 + 5.99 = 40.92, and the item discount 2.22 × 3 = 6.66. The reference file was checked the same way: its value equals the sum of price times quantity for its items.