Data & Analytics

How to Connect Stripe to Google Analytics 4 (Purchase Events, Step by Step)

How to connect Stripe to Google Analytics 4: send GA4 purchase events from your success page or your server with the Measurement Protocol, fix checkout.stripe.com referrals, and when you can skip it.

Vexlynk
Vexlynk Team · October 31, 2026 · 8 min read
Leer en español

If you want to connect Stripe to Google Analytics 4, the first thing to know is that there’s no switch for it. Stripe Checkout doesn’t send your sales to GA4 on its own. You send GA4 a purchase event yourself, either from the page your customer lands on after paying or from your server when Stripe tells you the payment went through. Stripe’s own GA4 guide shows both. This post walks through each one step by step, using Stripe’s and Google’s documentation as of October 2026, then covers the case where you don’t need any of it.

What Stripe Checkout does and doesn’t do with GA4

Stripe’s guide Analyze your conversion funnel is the official starting point. Here’s what it tells you:

  • Your GA tag goes on your own pages. The guide adds the Google tag to your product, success and cancel pages. It doesn’t put a tag on the Stripe-hosted payment page.
  • The checkout domain has to be excluded as a referrer. Its first instrumentation step is to add checkout.stripe.com to your referral exclusion list. Otherwise customers who come back from Checkout can look like new visits referred by Stripe.
  • You record the steps yourself. You fire begin_checkout before sending the customer to Checkout, and count the purchase either as a success page view or with a server-side purchase event sent when you receive the checkout.session.completed webhook.

So “connecting” Stripe to GA4 really means instrumenting your checkout flow. Stripe’s examples count purchases. If you also want revenue in GA4, the event has to carry the amount, as shown below.

Before you start

  1. Have a GA4 property with a web data stream, and the Google tag on your site.
  2. Exclude the Stripe checkout domain. In GA4, go to Admin, then Data collection and modification, then Data streams. Pick your web stream, open the tag settings, show all settings, and open List unwanted referrals. Add checkout.stripe.com and save. If you use a Stripe custom domain, Stripe says the Checkout URL uses your subdomain instead, so add that one.
  3. Know what GA4 needs for revenue. Google’s event reference lists transaction_id, value, currency and items as required for purchase. Google notes that if you set value, currency is required for revenue metrics to be computed accurately, and that transaction_id helps you avoid duplicate purchase events.

Option 1: send the purchase from your success page

This is the simplest way and works with your existing Google tag.

  1. Pass the session ID to your success page. When you create the Checkout Session, add the literal text {CHECKOUT_SESSION_ID} to your success_url, for example https://yoursite.com/success?session_id={CHECKOUT_SESSION_ID}. Stripe replaces it with the real ID after payment (Stripe: customize redirect behavior).
  2. Look up the session on your server. On the success page, retrieve the Checkout Session by that ID. It includes amount_total (the total after discounts and taxes), currency and payment_status.
  3. Fire the event. Print the values into the page and send a GA4 purchase event. Use the session ID as transaction_id, so a refresh doesn’t create a second sale.
gtag("event", "purchase", {
  transaction_id: "cs_live_...",   // the Checkout Session ID
  value: 20.00,                    // amount_total / 100 for USD
  currency: "USD",
  items: [{ item_id: "tshirt", item_name: "T-shirt", price: 20.00, quantity: 1 }]
});

Stripe amounts are integers in the smallest currency unit (Stripe’s own example uses 2000 for a $20 T-shirt), so divide before you send them. Also note that Google says value should be the sum of price times quantity for the items, without shipping or tax, while Stripe’s amount_total includes tax. Pick one rule and stick with it.

The weak spot: Stripe says you can’t rely on customers reaching the success page. Someone can pay and then lose their connection before the page loads. That sale will be in Stripe but missing from GA4.

Option 2: send the purchase from your server with the Measurement Protocol

This way GA4 gets the purchase even when the success page never loads.

  1. Create a Measurement Protocol API secret. In GA4, go to Admin, then Data collection and modification, then Data streams, pick your stream, click Measurement Protocol API secrets, then Create (Google: send Measurement Protocol events). You’ll also need the stream’s measurement ID.
  2. Capture the visitor’s GA client ID before checkout. Stripe’s guide reads it with gtag("get", ...), sends it to your server and stores it in the Checkout Session’s metadata. Google says the client_id should match the ID the Google tag generated on your site, because that’s how GA4 joins the server event to the visit.
  3. Listen for the webhook. Set up a webhook endpoint and handle checkout.session.completed. Stripe calls webhooks the most reliable way to confirm you got paid, and retries delivery if it fails.
  4. Send the event. POST to https://www.google-analytics.com/mp/collect with your measurement_id and api_secret, the stored client_id, and a purchase event that carries transaction_id, value, currency and items.

Things Google flags about the Measurement Protocol: it’s meant to add to your tag, not replace it, and if you send events only this way, “only partial reporting may be available”. Events you want joined to a visit should reach GA within 48 hours of it. For larger server-to-server setups, Google recommends its Data Manager API.

One more case: Stripe warns that payment methods like bank debits or vouchers can take 2 to 14 days to confirm, so listen for the extra payment events if you’ve turned those on. The session’s payment_status tells you whether the funds are available (paid) or not yet (unpaid).

Payment Links don’t add your Google tag either. What you can do, per Stripe’s Payment Links docs:

  • Under After the payment, redirect customers to a confirmation page on your site instead of Stripe’s message, and include {CHECKOUT_SESSION_ID} in that URL. Then use Option 1 on that page.
  • Add UTM codes to the payment link URL. Stripe adds them to your redirect URL automatically when the customer completes a payment.
  • Use the checkout.session.completed webhook, which Stripe also sends for payment links, for Option 2.

Stripe also shows views, sales and revenue for each payment link in the Dashboard. Stripe says that data can be delayed up to 18 hours and isn’t available for links with recurring prices.

Common problems after you connect Stripe and GA4

  • Purchases credited to checkout.stripe.com. The unwanted referral isn’t set, or you use a custom domain you didn’t add.
  • Revenue doesn’t match Stripe. Missing success page loads, tax handled differently, refunds, and amounts not divided from cents all make GA4 and Stripe disagree. GA4 is a behavior tool; Stripe stays your record of money.
  • Duplicate purchases. Send the same transaction_id (the session ID) from every place you fire the event.
  • Server purchases with no source or campaign. The client_id didn’t match the visitor’s, so GA4 couldn’t join the event to the visit.

Links checked October 31, 2026.

When you don’t need to: Stripe revenue next to GA4 on one board

Ask yourself why you want Stripe in GA4. If you need per-campaign conversion reports, ad conversions or funnel steps, the setup above is the right tool, and it takes real tagging work.

But many founders want something simpler: to see whether the day traffic jumped also showed up as money. For that you don’t have to move Stripe data into GA4 at all. In Vexlynk, Google Analytics 4 and Stripe each connect as a live card on one board. You approve Google Analytics on Google’s own consent screen and pick your GA4 property; for Stripe, you paste a key from your own account. The GA card shows traffic, acquisition channels and geography. The Stripe card shows revenue, subscriptions and recent payments, read-only. An AI agent reads both cards and answers questions like “did this week’s traffic bump show up in revenue?”, grounded in your own numbers and showing which cards it used.

To be honest about the limits: this is not attribution. Vexlynk puts traffic and revenue side by side and reasons over the timing; it isn’t a last-click or multi-touch attribution model, and it doesn’t write anything back to Stripe or GA4. If you need GA4 to credit each sale to a campaign, do the tagging. If you want both numbers in one window, see Stripe and Google Analytics on one board.

If what you really want is SQL over your Stripe history, that’s a warehouse question. See how to connect Stripe to BigQuery.

Frequently asked questions

Is there a native Stripe and Google Analytics 4 integration?

Stripe’s GA4 guide doesn’t describe a switch in either product. It has you tag your own product, success and cancel pages and record the purchase yourself, either on the success page or from your server with the Measurement Protocol when you receive the checkout.session.completed webhook.

Why does GA4 show checkout.stripe.com as a referral?

Customers leave your site to pay on Stripe’s domain and come back to your success page. Add checkout.stripe.com, or your Stripe custom domain, to List unwanted referrals in your GA4 web stream’s tag settings.

Should I send the purchase from the success page or the server?

The success page is simpler, but Stripe says customers aren’t guaranteed to reach it. The server route with the webhook catches every completed checkout, but it needs a stored GA client ID to join the purchase to the visit. Many setups use one or the other; if you use both, send the same transaction_id.

Will GA4 revenue match my Stripe revenue?

Rarely exactly. Missed page loads, tax and shipping rules, refunds and delayed payment methods all create gaps. Use Stripe for the money and GA4 for where buyers came from.

Can I see Stripe and GA4 together without any tagging?

Yes, if side by side is enough. Vexlynk connects Google Analytics 4 and Stripe as live, read-only cards on one board, and its AI agent reads both together. It doesn’t do attribution and doesn’t send events to GA4.

Vexlynk

Vexlynk Team

More from Vlynk