Skip to main content
Braintree → GA4Integration guide

Connecting Braintree to GA4

Braintree is a payment gateway rather than a storefront, so it sits underneath whatever is taking the order and holds the transaction itself. GA4 is where the business goes to understand what happened, which makes an unattributed conversion there expensive in decisions rather than in ad spend. The join between them succeeds or fails on one thing: whether the GA4 client_id reaches the Braintree transaction before the conversion happens, because GA4 can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Braintree to GA4: purchase events that keep the original session

Read client_id and session_id from the _ga cookies when your server calls transaction.sale and store each in a Braintree custom field defined in the Control Panel. Send the Measurement Protocol purchase with the Braintree transaction ID, from one side only, and the merchant account's currency. Late settlement reports on the send date; refunds use the original transaction ID.

A Braintree transaction carries no GA4 identity, so the client_id has to go into a custom field when your server calls transaction.sale, read from the _ga cookie on the request that creates it. Braintree only accepts custom fields that are defined in the Control Panel first, so create one for client_id and one for session_id rather than packing both into a string you will have to parse later.

Send the Measurement Protocol purchase with transaction_id set to the Braintree transaction ID. If the confirmation page also fires a browser purchase, pick one side to send it; GA4 will not deduplicate between them, and with PayPal buyers the server is the side that sees every sale. Braintree sets currency per merchant account, so if you run one merchant account per currency, read the currency from the account the transaction went through instead of hard-coding it.

Timing is the GA4-specific catch. Settlement usually lands in a batch hours after authorization, and the Measurement Protocol only accepts timestamps a short way in the past (72 hours at the time of writing; confirm the current limit). Anything settling later reports on the day it is sent. For refunds, Braintree creates a separate credit transaction that points at the original; send GA4's refund event with the original transaction ID, not the credit's.

Braintree → GA4 · what breaks

Why this join usually fails — Braintree → GA4

  1. 01

    The GA4 client_id never reaches Braintree

    Braintree is a gateway, so it sees the payment and not the marketing. The identifier has to be attached at the point your application creates the transaction, through custom fields, or it never enters Braintree at all.

  2. 02

    A gateway that knows nothing about marketing

    Braintree sees a payment. Whether it can be tied to a click depends entirely on whether your own application attached the identifier when creating the transaction, and most do not.

  3. 03

    Everything lands under (direct)/(none)

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  4. 04

    Nothing reconciles afterwards

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

Braintree → GA4 · the fix

What working looks like — Braintree → GA4

  • The GA4 client_id on every transaction

  • Conversions arriving in GA4

    Conversions appear in GA4 attributed to the original session's source and medium, so acquisition reporting reflects what actually drove revenue.

  • Reconciled against the source

Braintree → GA4 · architecture

How Braintree and GA4 actually connect

  1. 1

    Braintree holds the truth

    Settled and authorised are different states. Authorisation reserves the funds; settlement is money moving, and reporting on the wrong one produces a persistent gap against your bank.

  2. 2

    GA4 needs a click to match

    GA4 needs the client_id to attach a server event to the user and session that produced the click. Without it there is no attribution to inherit and the event is orphaned.

  3. 3

    The identifier is the bridge

    The GA4 client_id, captured at the visit and carried into the Braintree transaction.

  4. 4

    The event source decides reliability

    Fire on settlement rather than authorisation, and note that Braintree's PayPal and wallet flows redirect the buyer away — so the confirmation page is not a reliable trigger.

  5. 5

    Deduplication at the destination

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

Braintree → GA4 · normal or broken

Working vs. broken, side by side — Braintree → GA4

Normal, not a fault

  • The GA4 client_id present on the transaction

  • Sent from the Braintree transaction settlement webhook

  • Deduplicated correctly

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

  • Reconciles with the source

Actually broken

  • The GA4 client_id missing on most records

    Braintree is a gateway, so it sees the payment and not the marketing. The identifier has to be attached at the point your application creates the transaction, through custom fields, or it never enters Braintree at all.

  • Sent from the browser

    Braintree sees a payment. Whether it can be tied to a click depends entirely on whether your own application attached the identifier when creating the transaction, and most do not.

  • Counted twice, or not at all

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  • Nobody has reconciled it

Braintree → GA4 · diagnose

Diagnostic order — Braintree → GA4

  1. 01

    Count transactions carrying the GA4 client_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Open a settled transaction and check its custom fields

    If the identifier is not there, your application never attached it and nothing downstream can recover it.

  4. 04

    Check whether server events carry a session and a source

    In GA4 Realtime or DebugView, find the event and look at its session and traffic source. A brand-new user with no source on every server event is the missing-client_id signature.

  5. 05

    Read the match rate, not the success message

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

Braintree → GA4 · prove

How it gets proven — Braintree → GA4

Source of truth

Braintree's transaction records, filtered to settled, for the same window.

  • The GA4 client_id confirmed present on a live transaction.
  • Server events confirmed in DebugView attaching to an existing session with the original traffic source intact.
  • A PayPal-funded transaction confirmed to report even though the buyer was redirected away.

Braintree → GA4 · free audit

What we check in the free audit

  • Count transactions carrying the GA4 client_id
  • Follow one real conversion end to end
  • Open a settled transaction and check its custom fields
  • Check whether server events carry a session and a source
  • Read the match rate, not the success message

Checked against

Braintree's transaction records, filtered to settled, for the same window.

Get my free conversion tracking audit

Free30 minutesNo obligation

Braintree → GA4 · when not to buy

When you don't need this — Braintree → GA4

  • Measure identifier coverage yourself first — pull your last hundred transactions and count how many carry the GA4 client_id.
  • If your platform already reports orders accurately and Braintree is purely the funding rail, work at the order layer instead — it is closer to the customer.
  • GA4 is reporting, not bidding. If your problem is ad platform optimization, fix the ad platform destination first — GA4 will not change what any campaign does.

Braintree → GA4 · what we deliver

What gets built — Braintree → GA4

  • Identifier capture into Braintree

    Pass the click identifier into the transaction's custom fields when your server creates the charge. Braintree preserves them and they survive to the webhook and to any later refund.

  • Event source: the Braintree transaction settlement webhook

    Fire on settlement rather than authorisation, and note that Braintree's PayPal and wallet flows redirect the buyer away — so the confirmation page is not a reliable trigger.

  • Dispatch to GA4

    Measurement Protocol events with the client_id, session_id and the correct measurement ID and API secret, sent server-side.

  • Reversals where they exist

    Braintree exposes refunds and disputes, both carrying the original custom fields, so reversals are straightforward.

Written guarantee

95%+ tracking accuracy

Measured against Braintree's transaction records, filtered to settled, for the same window.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Braintree → GA4 questions, answered

The Measurement Protocol call went out without the client_id from the shopper's _ga cookie, or with one your server made up. Store the real value in a Braintree custom field at sale time and send it back unchanged.

Free · 30 min

Get Braintree and GA4 joined properly

Free30 minutesNo obligation