There's no built-in connection between Stripe and Google Analytics 4 in either product's docs that we checked on 30 October 2026, so you have to build the bridge yourself. The usual way: read the visitor's GA4 client ID in the browser, put it in the Stripe Checkout metadata, and when Stripe's webhook says the payment succeeded, send a purchase event to GA4 from your server with the Measurement Protocol. It works, but you own the code, the renewals, the refunds and the gaps. If all you need is "which traffic brings paying customers", a tool that reads Stripe directly is less work.
Last updated 30 October 2026. The GA4 steps below are based on Google's and Stripe's docs as of that date; we haven't run them on a live site. The docs can change, so the links are inline.
Why GA4 doesn't see Stripe payments on its own
GA4 records revenue only from purchase and refund events that your site or server sends, each with a transaction_id (Google: measure ecommerce). Stripe holds the payment, but it doesn't know which GA4 visitor made it. A payment that happens on Stripe's hosted checkout, or a subscription renewal a month later, never passes through your GA4 tag.
So you need two things: a way to tell Stripe who the visitor was, and a way to tell GA4 that the payment happened.
The GA4 method, step by step
1. Read the GA4 client ID when checkout starts
Server-side events for a web stream are tied to a visitor through the client_id, which "should match the ID generated by the Google Analytics tag on your website" (Google: send Measurement Protocol events). Read it in the browser when the visitor clicks your checkout button, together with the session ID if you want the purchase in the same session, and send both to your server with the checkout request.
If the visitor declined analytics cookies, the GA4 tag hasn't stored a client ID, so there is nothing to pass. That payment can't be tied to a GA4 visitor.
2. Put the IDs in Stripe Checkout metadata
Your server creates the Checkout Session and adds the IDs as metadata, for example ga_client_id and ga_session_id (Stripe: metadata). For subscriptions, put them on the subscription's metadata too, so renewal invoices can be matched to the same visitor later.
If you sell with Payment Links and no server, Stripe passes UTM parameters from the link to your redirect URL after payment (Stripe: Payment Link URL parameters). That carries the campaign, not the GA4 client ID, and only if the buyer reaches your redirect page.
3. Send the purchase from your Stripe webhook
When Stripe reports a paid Checkout Session or invoice, your webhook handler posts a purchase event to https://www.google-analytics.com/mp/collect with your Measurement ID, an API secret and the stored client_id. Google says the API secret must stay on the server (Google: send Measurement Protocol events).
js
// Stripe webhook handler (server-side), after verifying the signature.
// Example only: adapt to your own checkout and error handling.
await fetch(
`https://www.google-analytics.com/mp/collect?measurement_id=${process.env.GA_MEASUREMENT_ID}&api_secret=${process.env.GA_API_SECRET}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client_id: session.metadata.ga_client_id,
events: [{
name: 'purchase',
params: {
transaction_id: session.id,
value: session.amount_total / 100,
currency: session.currency.toUpperCase(),
session_id: session.metadata.ga_session_id,
},
}],
}),
},
);Send a refund event with the same transaction_id when Stripe reports a refund (Google: measure ecommerce). For each subscription renewal, send another purchase with the client ID stored on the subscription.
4. Stop checkout.stripe.com from becoming the source
When a buyer comes back from Stripe's hosted checkout to your site, GA4 can count that return as a referral from Stripe. GA4's "unwanted referrals" setting exists for exactly this case: a separate shopping-cart domain whose traffic shouldn't be categorized as referrals (Google: identify unwanted referrals). Add Stripe's checkout domain there.
Where the GA4 method gets hard
- It's meant to supplement the tag, not replace it. Google says the Measurement Protocol is intended to "augment" collection through gtag, Tag Manager or Firebase, and that you must use tagging alongside it (Google: Measurement Protocol overview).
- Late events. Events can be backdated only up to 72 hours (Google: send Measurement Protocol events). A webhook backlog older than that can't be placed at its real time.
- Declined consent. No GA4 cookie means no client ID, so those payments can't be tied to a visit.
- Renewals and refunds are your code. Every invoice and every refund needs its own event, sent once.
- You can't see what didn't match. GA4 only shows purchases you sent. A payment your webhook skipped, or one without a client ID, simply isn't there, and nothing tells you how much is missing.
The simpler path: read Stripe directly
traffic.cx connects to Stripe with a restricted key, creates the webhook itself and imports the last 90 days of payments (Stripe setup guide). You still pass one ID into checkout: the visit's pageview ID (tcx_pvid) in the Checkout Session metadata, and on the subscription for renewals. Payment Links take it as client_reference_id.
From there:
- Subscription renewals and refunds come in from Stripe on their own (Stripe setup guide).
- Payments that can't be matched to a visit stay in your totals as Unattributed instead of disappearing (UTM to revenue walkthrough).
- You choose last non-direct (the default) or first touch, with a 90-day lookback you can set from 7 to 365 days (how revenue attribution works).
- The revenue report shows revenue, paying customers, visitors, revenue per visitor, conversion rate and lifetime value by channel, source, campaign, landing page, country and device (Stripe revenue by traffic source).
The tracker sets no visitor cookie by default. In that mode, a payment links to the visit where checkout started; optional cookie mode also links earlier visits from the same browser (how revenue attribution works).
Keep GA4 if you rely on its data-driven attribution, BigQuery export or years of history there. The two can run side by side. For a fuller comparison, see traffic.cx vs Google Analytics.
FAQ
Does Stripe integrate with Google Analytics 4?
Not directly, in the Stripe and Google docs we checked on 30 October 2026. You connect them yourself: pass the GA4 client ID into Stripe Checkout metadata, then send a purchase event from your Stripe webhook with the Measurement Protocol.
Can GA4 show Stripe subscription renewals?
Only if your server sends a purchase event for each paid renewal invoice, with the client ID you stored on the subscription. GA4 doesn't read Stripe on its own.
Why does Stripe show up as a referral in GA4?
Buyers return from Stripe's hosted checkout to your site, and GA4 can count that return as a referral. Add Stripe's checkout domain to GA4's unwanted referrals list.
How do I see Stripe revenue by traffic source without GA4?
Use an analytics tool that connects to Stripe. In traffic.cx, you connect Stripe with a restricted key and pass the visit's pageview ID into checkout metadata; the revenue report then shows Stripe revenue by channel, source, campaign and landing page.
Is traffic.cx free?
Yes, on one site: every feature, 3,000 events a month and the last 30 days of reports. Sign up with Google or email; no card is needed and there's no trial that runs out (pricing).