SaTracking
Events and dataNEWIntermediate

Implement a GA4 purchase event with transaction and item data

Build a purchase event from a confirmed order, place transaction and item data correctly, and validate its value and currency.

Download for AI (.txt)

Measurement topic illustration · SaTracking

Audience and prerequisites

Build the purchase payload with a unique transaction_id, item array, currency and value, then validate totals and duplicate protection before release. You need an order-confirmation state that comes from the store, a GA4 web stream, and permission to change either the site's Google tag or its GTM container. Skill level: intermediate. The reading estimate is eight minutes.

1. Use the confirmed order as the trigger

Send purchase only after the order system confirms a completed order. A checkout button, payment attempt, or return to a generic thank-you route can happen without a completed sale. Use the order record as the source of truth and prevent a refresh or repeated callback from creating another send.

Create a stable transaction identifier from the order system. Do not put a customer name, email, or other personal information in it. Google's reference says transaction_id helps avoid duplicate purchase events; it is an identifier, not a substitute for firing the event once.

2. Put transaction and item fields at the right level

The event describes the order; items is an array describing its products or services. Include the item identifiers and item details that the current GA4 ecommerce reference supports. Set the order's monetary value using your agreed revenue definition. When sending value, also send the ISO 4217 currency code for that value. Do not assume tax, shipping, refunds, or discounts are included in your total; define and document that calculation for your reporting.

Direct Google tag (gtag.js)

Use this only when the Google tag is installed directly and the application can provide the real order values. Replace every example value from the confirmed order response; this is a shape example, not production order data.

js
gtag('event', 'purchase', {
  transaction_id: 'ORDER_12345',
  value: 79.99,
  currency: 'USD',
  items: [{
    item_id: 'SKU_001',
    item_name: 'Example product',
    price: 79.99,
    quantity: 1
  }]
});

Google Tag Manager

For GTM, send the order object to the shared data layer after confirmation, then configure an ecommerce event tag and its trigger and mappings using Google's GTM ecommerce instructions. A data-layer push is only a message; it does not send the purchase to GA4 on its own. Avoid simultaneously sending the direct gtag() call and the GTM tag for the same order.

3. Validate one controlled order

In Tag Assistant, verify the event name, destination, transaction identifier, value, currency, and item array. Then confirm that the event appears in the correct GA4 property's DebugView. Compare the payload with the ecommerce reference; the event showing in a browser debugger does not by itself prove that every report or downstream process is correct.

If purchase is missing, check that the confirmation callback ran and that consent and blockers permit the configured tag. If it appears twice, inspect refresh behavior, payment redirects, duplicate tags, and direct-plus-GTM implementations. If revenue is wrong, check the currency and the store's value calculation instead of changing values in GTM to conceal a source-data defect.

Privacy and limits

Send only the order and product details needed for measurement. Keep names, email addresses, postal addresses, payment details, and free-text notes out of event parameters and URLs. Apply the site's consent rules to Google tags. GA4's transaction ID guidance helps with duplicate handling; it does not repair incorrect order logic or guarantee provider processing.

Use the GA4 end-to-end validation guide to record the browser and DebugView evidence for a controlled order.

Official references

EDITORIAL HISTORY

What changed

  1. v1.0.0
    Initial bilingual guide drafted and verified against linked official Google documentation.
MEASUREMENT SUPPORT

Need a hand with your tracking?

Nicolas Salazar works with teams on analytics, tracking plans, data quality, consent, and implementation.