Skip to main content
Stripe → GA4Integration guide

Connecting Stripe to GA4

Stripe knows exactly what was paid, by whom, and when — down to the cent, including the refund three weeks later. 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 Stripe Customer or PaymentIntent 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

Stripe to GA4: purchases that don't arrive from checkout.stripe.com

Add checkout.stripe.com to GA4's unwanted referrals, then read client_id and session_id from the _ga cookies when creating the Checkout Session and put them in payment_intent_data.metadata. Send purchase via Measurement Protocol with transaction_id set to the PaymentIntent ID and value converted from minor units. Send the first invoice.paid as purchase, and refunds on the same transaction_id.

When a buyer returns from Stripe Checkout, GA4 sees a visit referred by checkout.stripe.com and starts a new session credited to Stripe, unless that domain is on the property's unwanted referrals list. That one setting explains many reports where Stripe appears as a top revenue source, and it costs nothing to fix.

For the server side, read client_id and session_id from the _ga cookies when your server creates the Checkout Session and put them in payment_intent_data.metadata, not only in the session's own metadata. Checkout Session metadata does not copy onto the PaymentIntent, so a handler listening to payment_intent.succeeded will not find it there. Send purchase with transaction_id set to the PaymentIntent ID and the value converted from Stripe's integer minor units.

Subscriptions need separate handling. invoice.paid fires on every renewal; send the first one as purchase, and decide whether renewals go to GA4 at all, because they arrive months later with no session and only user-level attribution. For refunds, charge.refunded can trigger GA4's refund event with the same transaction_id, keeping GA4 revenue closer to Stripe's net figure.

Stripe → GA4 · what breaks

Why this join usually fails — Stripe → GA4

  1. 01

    The GA4 client_id never reaches Stripe

    Stripe Checkout runs on checkout.stripe.com, a different origin from your site, so nothing you set in a first-party cookie travels with the customer. The identifier has to be put into PaymentIntent metadata (or the Checkout Session's metadata) at the moment you create the session, server-side. If you create sessions from a price link or a Buy Button, there is no server step and no metadata — that setup cannot be joined to advertising at all without changing how sessions are created.

  2. 02

    Checkout is on Stripe's domain, so the browser loses the thread

    The customer leaves your site, pays somewhere else, and comes back to a thank-you page. Anything relying on browser continuity across that hop is unreliable, and on Safari it is worse than unreliable.

  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.

Stripe → GA4 · the fix

What working looks like — Stripe → GA4

  • The GA4 client_id on every payment

  • 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

Stripe → GA4 · architecture

How Stripe and GA4 actually connect

  1. 1

    Stripe holds the truth

    Every succeeded PaymentIntent is a real conversion with a real amount and currency. No sampling, no modeling, no consent gate. This is the number the business actually banked, which is why it is the reference rather than anything either ad platform reports.

  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 Stripe Customer or PaymentIntent.

  4. 4

    The event source decides reliability

    Subscribe to payment_intent.succeeded (or checkout.session.completed) and send from your server when Stripe fires it. Reading a payment from the thank-you page instead means every customer who closes the tab on the redirect is a conversion you never counted, and Stripe redirects after taking money, not before.

  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.

Stripe → GA4 · normal or broken

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

Normal, not a fault

  • The GA4 client_id present on the payment

  • Sent from the Stripe 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

    Stripe Checkout runs on checkout.stripe.com, a different origin from your site, so nothing you set in a first-party cookie travels with the customer. The identifier has to be put into PaymentIntent metadata (or the Checkout Session's metadata) at the moment you create the session, server-side. If you create sessions from a price link or a Buy Button, there is no server step and no metadata — that setup cannot be joined to advertising at all without changing how sessions are created.

  • Sent from the browser

    The customer leaves your site, pays somewhere else, and comes back to a thank-you page. Anything relying on browser continuity across that hop is unreliable, and on Safari it is worse than unreliable.

  • 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

Stripe → GA4 · diagnose

Diagnostic order — Stripe → GA4

  1. 01

    Count payments carrying the GA4 client_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Open one succeeded PaymentIntent in the Stripe dashboard

    Look at its Metadata section. If the identifier is not there, nothing downstream can fix it — the join is broken at the source and every other check is wasted effort.

  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.

Stripe → GA4 · prove

How it gets proven — Stripe → GA4

Source of truth

The Stripe dashboard — Payments, filtered to succeeded, for the same window.

  • The GA4 client_id confirmed present on a live payment.
  • Server events confirmed in DebugView attaching to an existing session with the original traffic source intact.
  • A refunded payment confirmed to reverse, not just the sale confirmed to send.

Stripe → GA4 · free audit

What we check in the free audit

  • Count payments carrying the GA4 client_id
  • Follow one real conversion end to end
  • Open one succeeded PaymentIntent in the Stripe dashboard
  • Check whether server events carry a session and a source
  • Read the match rate, not the success message

Checked against

The Stripe dashboard — Payments, filtered to succeeded, for the same window.

Get my free conversion tracking audit

Free30 minutesNo obligation

Stripe → GA4 · when not to buy

When you don't need this — Stripe → GA4

  • Measure identifier coverage yourself first — pull your last hundred payments and count how many carry the GA4 client_id.
  • If you take payment through a hosted Payment Link or Buy Button and have no server creating sessions, this needs a development change on your side before any tracking work is worth commissioning. Worth knowing before you pay for tracking.
  • 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.

Stripe → GA4 · what we deliver

What gets built — Stripe → GA4

  • Identifier capture into Stripe

    Read the click identifier from the landing page, persist it in a first-party cookie, and pass it into the create-session call as metadata. Stripe carries metadata onto the resulting PaymentIntent and Charge, so it survives to the webhook and to any later refund.

  • Event source: the Stripe webhook

    Subscribe to payment_intent.succeeded (or checkout.session.completed) and send from your server when Stripe fires it. Reading a payment from the thank-you page instead means every customer who closes the tab on the redirect is a conversion you never counted, and Stripe redirects after taking money, not before.

  • 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

    Stripe fires charge.refunded and charge.dispute.created. Both carry the original metadata, so a refund can be sent as a negative or a retraction wherever the destination supports it. Most setups never wire this and quietly overstate revenue by the refund rate.

Written guarantee

95%+ tracking accuracy

Measured against The Stripe dashboard — Payments, filtered to succeeded, for the same window.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Stripe → GA4 questions, answered

The return from Stripe Checkout starts a new session. Add checkout.stripe.com to the unwanted referrals list in your GA4 data stream settings.

Free · 30 min

Get Stripe and GA4 joined properly

Free30 minutesNo obligation