Analytics and Tracking

Transaction ID

The unique order reference sent with purchase tracking, so analytics and ad platforms count each sale once and can match it to your records.

Quick facts: Transaction ID

Category
Analytics and Tracking
Level
Intermediate
Affects
Ecommerce revenue, ROAS, conversion deduplication, refunds, reconciliation with finance
Where to see it
GA4 explorations, GA4 DebugView, Google Ads conversion settings, Meta Events Manager, your shop admin
In this article4
  1. How a transaction ID works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

A transaction ID is the unique reference attached to an order or payment when it is reported to analytics and advertising platforms, usually the same order number your shop or booking system creates. It lets each tool recognise one purchase as one purchase, however many times the confirmation page loads.

How a transaction ID works

When a customer completes a purchase, your site sends a purchase event to GA4 and conversion events to platforms such as Google Ads and Meta. Alongside the value, currency and items, the event carries the transaction ID, which GA4 calls transaction_id. If the same ID arrives again, because the customer refreshed the confirmation page, came back to it from an email or opened it in a second tab, GA4 can treat the repeat as a duplicate rather than a new sale.

Google Ads uses the ID in the same way for its own conversion counting, and it is also the reference you use to adjust or retract a conversion later, for example after a return. Meta matches duplicates between its browser pixel and its Conversions API using an event ID, which many setups set to the order number for purchases.

Refunds rely on the same reference. A refund event sent to GA4 with the original transaction ID records the refund against the right order, so revenue in your reports reflects what you actually kept.

Why it matters

Without a reliable transaction ID, the revenue in your reports drifts away from what reaches the bank. Duplicate transactions inflate revenue and return on ad spend, and that can push automated bidding to spend more on campaigns that are not earning it.

The ID is also the bridge between marketing data and finance data. A UK online shop reconciling GA4 with Shopify, WooCommerce or its accounting software can match order by order and see exactly which sales tracking missed. That is often the quickest way to spot a broken return from a payment provider, where customers pay on another site and never reach your confirmation page.

Common mistakes

  • Leaving the ID blank or hard-coding a placeholder such as “12345”, so every order looks like the same order.
  • Generating a random ID each time the page loads instead of using the real order number, which defeats deduplication on refresh.
  • Putting a customer’s email address, name or postcode in the ID. That is personal data and has no place in analytics.
  • Using different references in GA4, Google Ads and Meta, or the same reference in different formats such as “#1042” in one and “1042” in another, so nothing can be reconciled.
  • Firing the purchase event on a page customers revisit, such as an order history page, without any check on the ID.

How to act on it

Pick a handful of recent orders, find each one in your shop’s admin, then look for the same number in GA4 using an exploration with the Transaction ID dimension. If IDs are missing, repeated or do not match, fix the data layer so the confirmation page pushes the real order number with the purchase. If you take payments through more than one system, such as a shop and a separate booking tool, make sure their number ranges cannot clash, for example by adding a short prefix to one of them.

Then test: place an order and refresh the confirmation page several times; revenue should rise once. Getting purchase tracking right is the foundation of the ecommerce work I do in performance marketing, because every bid and budget decision rests on it.

Do and do not

Do

  • Use the real order number from your shop or booking system
  • Send the same ID to every platform
  • Test by refreshing the confirmation page

Do not

  • Leave the ID blank or hard-code a placeholder
  • Generate a new random ID on every page load
  • Put email addresses or names in the ID

Questions people ask about this

Does GA4 remove duplicate purchases with the same transaction ID?

GA4 uses the transaction ID to deduplicate purchase events, so a refreshed confirmation page should not count twice when the ID is identical. It cannot help if the ID is missing or changes on each load. Check your ecommerce reports for repeated order numbers to confirm deduplication is working.

What should I use as a transaction ID?

Use the order or booking number your own system already creates, exactly as it appears in your admin. It must be unique per order and identical in every tool you send it to. Never build it from a customer's email, name or phone number.

Do I need a transaction ID if I only track leads?

GA4's transaction_id belongs to purchase events, but the idea still helps for leads. Sending a unique enquiry reference with lead conversions lets Google Ads and Meta deduplicate them and lets you match tracked leads to your CRM. It also makes uploading offline conversions much easier later.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.