Analytics and Tracking

Transaction ID

Also called Order ID, transaction_id

The unique order reference sent with a purchase, used by platforms to recognise and discard repeated records of one sale.

Quick facts: Transaction ID

Category
Analytics and Tracking
Also called
Order ID, transaction_id
Level
Beginner
Affects
Revenue accuracy, return on ad spend, bidding, refund matching
Where to see it
GA4 DebugView, Google Ads conversion settings, shop platform order records
In this article4
  1. What a transaction ID does
  2. Why the transaction ID matters
  3. Where transaction IDs go wrong
  4. How to get it right

What a transaction ID does

A transaction ID is the reference that identifies one order and no other. It is sent with the purchase event, and analytics and advertising platforms use it as the key that decides whether an incoming record is a new sale or a repeat of one they already have. Send the same identifier twice and the second is discarded; send two different identifiers for one sale and both are kept.

The right value is almost always the order number your shop platform already generates, because it is unique, stable and traceable — you can look it up when a report and your books disagree. What it must never be is a timestamp, a session identifier or a random number generated on the page, because all three produce a fresh value every time the confirmation page loads, which is precisely the situation the field exists to handle.

Why the transaction ID matters

It is the only thing standing between your revenue report and double counting, and a shopper does not have to do anything unusual to trigger it. Refreshing the thank-you page, bookmarking it, reaching it again through the browser’s back button, or returning from a payment gateway that loads the page twice will each send another purchase event.

The consequence is worse than an inflated report. Google Ads and Meta bidding learn from the conversions you send them, so duplicated orders teach the system that some traffic is more profitable than it is, and budget follows that belief. Inflated revenue also flatters return on ad spend, which makes the underlying error hard to spot: nobody investigates a number that looks good.

Where transaction IDs go wrong

Generating the value in the browser is the most common fault, and it defeats deduplication entirely. Sending an empty field is next; a purchase event with no identifier is accepted, so nothing warns you, but no repeat can ever be recognised.

Then there are mismatches between systems. If GA4 receives the shop’s order number while Google Ads receives a different reference for the same sale, neither platform can be reconciled against the other or against your accounts. The same applies to server-side sending: when a purchase arrives from both the browser and the server, they must carry the identical identifier or the order is counted once from each source.

The last one is order numbers that restart. Some shops reset their numbering each year or run separate sequences per branch, which eventually recycles an identifier and causes a genuine new order to be discarded as a duplicate.

How to get it right

Use the platform’s own order number, send it to every system that records the sale, and confirm the value is identical in each. Then test it the way a shopper would break it: place a real order, refresh the confirmation page, navigate away and come back, and complete an order through your payment gateway’s redirect, checking in GA4’s DebugView that only one purchase is recorded each time.

Finally, reconcile a full month of orders and revenue against your shop platform. A gap in either direction points at this field before anything else, and closing it is routine work in an analytics and tracking review.

Do and do not

Do

  • Use the shop platform's own order number
  • Send the same identifier to every platform recording the sale
  • Refresh the confirmation page while testing for duplicates

Do not

  • Generate the value in the browser or from a timestamp
  • Send a purchase event with the field empty
  • Reset or recycle order numbering between years or branches

Questions people ask about this

What should I use as the transaction ID?

The order number your shop platform already creates. It is unique, it does not change, and it lets you trace a single order from a report back to your own records when the two disagree. Avoid timestamps, session identifiers and values generated in the browser, because each one produces a new value on every page load.

Does GA4 automatically remove duplicate purchases?

Only when a transaction ID is present and repeated. GA4 uses that value to recognise a sale it has already recorded and drops the repeat. Without an identifier, or with a new one generated each time the confirmation page loads, every reload is treated as a genuine new order and your revenue quietly climbs above reality.

Should Google Ads and GA4 use the same transaction ID?

Yes, and so should any server-side sending you set up. Using one identifier everywhere lets each platform recognise duplicates of its own records and lets you reconcile the platforms against each other and against your accounts. Different references for the same sale make every discrepancy impossible to investigate without manual matching.

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.