Cookie preferences

Choose which optional cookies EndFrame may use on this site. Analytics and advertising tools load only if you allow them, and you can change your mind any time from “Cookie settings” in the footer. Whatever you choose, this tab keeps the campaign labels from the link that brought you, and they are saved with your account if you sign up. Read the Cookie Policy.

Needed for the site to work, such as remembering this choice. Always on.

Lets us load analytics tools through Google Tag Manager, including Google Analytics and Microsoft Clarity session recordings, to understand how the site is used.

Allows advertising tags to measure our ad campaigns. None run on this site today. It also keeps ad click IDs from the page address for this tab, and saves them with your account if you sign up.

Skip to main content

Stripe Conversion Tracking: Record Checkout and Payment Link Sales in GA4 and Ad Platforms

Payments on checkout.stripe.com and buy.stripe.com happen where your GA4 tag and ad pixels cannot see them. The two patterns Stripe documents, the Payment Link parameters that carry campaign data, and delayed payments and subscriptions.

The EndFrame Team7 min read

Stripe conversion tracking fails for a simple reason: hosted Stripe Checkout runs on checkout.stripe.com and Payment Links run on buy.stripe.com, and your GA4 tag, Meta Pixel and TikTok Pixel do not load on either. The payment happens on a page you do not control, so nothing on it can report a purchase to your analytics or ad accounts. Stripe documents two reliable ways to record the sale: fire the purchase on a success page on your own site after Stripe sends the buyer back, or send it from your server when Stripe's checkout.session.completed webhook arrives. This guide covers both, the Payment Link parameters that carry campaign data through Stripe, and the cases where the choice matters most.

Why your tags cannot see a Stripe payment

Your site creates a Checkout Session (Stripe's record of one checkout attempt), sends the buyer to its URL, and waits. While the buyer enters card details, none of your tags are running. Two problems follow. First, nothing fires a purchase unless you build one of the patterns below. Second, when the buyer returns, the browser reports Stripe as the referrer, and GA4 can credit the sale to Stripe instead of the campaign that brought the buyer. Stripe's own GA4 guide starts by excluding checkout.stripe.com as a referral, a setting GA4 now calls List unwanted referrals. Add buy.stripe.com as well if you use Payment Links. Our guide to payment gateway referrals in GA4 shows where the setting lives.

Pattern 1: fire the purchase on your success page

This is the simplest option and needs the least server work. Stripe sends the buyer to a page on your site, and your tags fire the purchase there.

  1. 1Set the return address. For Checkout, it is the success_url your developer sets when creating the Checkout Session. For a Payment Link made in the Dashboard, open the link, go to the After payment tab, choose Don't show confirmation page and enter your own URL.
  2. 2Add the session placeholder. Stripe replaces {CHECKOUT_SESSION_ID} in that URL with the real session ID, so example.com/thanks?session_id={CHECKOUT_SESSION_ID} arrives as a unique address for each order.
  3. 3Have your server look up the Checkout Session by that ID and print the order value, currency and ID into the page, so your tags read real numbers rather than a fixed price.
  4. 4Fire the GA4 purchase event with transaction_id set to the session ID, plus value and currency, and fire the Meta and TikTok purchase events with the same values.
  5. 5Make a test payment in a Stripe sandbox and confirm the event in GA4 DebugView and in each platform's test events screen.

Stripe names the weaknesses of this pattern itself. Some checkout flows have no success page. The redirect can fail, for example when a buyer pays and then loses their connection before your page loads, and that purchase is never recorded. And buyers who refresh the success page, because it shows a confirmation number or delivery details, can fire the purchase again. Google says GA4 deduplicates purchases that share a transaction ID, which is why step 4 matters, but ad pixels need their own protection, such as firing only on the first load of each session ID.

Pattern 2: send the purchase from the webhook

A webhook is a message Stripe sends to your server when something happens. When a buyer completes Checkout, Stripe sends checkout.session.completed, and Stripe retries delivery if your server does not respond. Stripe's fulfilment guide is blunt that you cannot rely on the landing page alone because buyers are not guaranteed to reach it. The same logic applies to counting conversions. The catch is that a purchase sent from your server through the GA4 Measurement Protocol knows nothing about the visit unless you pass that information along.

  1. 1When the buyer clicks your checkout button, read the GA4 client_id and session_id from the page with the gtag get command.
  2. 2Send both to your server with the request that creates the Checkout Session, and store them in the session's metadata. Stripe allows 50 metadata keys, with keys up to 40 characters and values up to 500.
  3. 3When checkout.session.completed arrives, read the metadata back, check that payment_status is paid, and send a purchase to the Measurement Protocol with the stored client_id, session_id, transaction_id, value and currency.
  4. 4Record which sessions you have already reported. Stripe warns that the same session can reach your code more than once, possibly at the same time.

Timing matters for attribution. Google's documentation says an event sent to join an online session must arrive no later than 24 hours after that session started, and its session_id must be in the event parameters. Without it, GA4 cannot attach the purchase to the visit that produced it. Our guide to sending server-side conversions to GA4 covers the request format. Note that Stripe's sample code for linking client and server events still posts to an older Universal Analytics endpoint, so build the request from Google's current Measurement Protocol documentation instead. Whichever pattern you choose, send each purchase to GA4 from one place only.

Payment Links: UTM codes and client_reference_id

Payment Links are often shared straight into an email, a social bio or a direct message, so the buyer may never visit your site before paying. Stripe gives you two URL parameters to carry information through the payment.

ParameterWhat Stripe acceptsWhere it comes out
utm_source, utm_medium, utm_campaign, utm_content, utm_termLetters, numbers, dashes and underscores, up to 150 characters. Invalid values are discarded silently.Appended to your redirect URL after payment, but only when the confirmation behaviour is set to redirect
client_reference_idLetters, numbers, dashes and underscores, up to 200 characters. Invalid values are dropped silently.In the checkout.session.completed webhook

Two consequences are easy to miss. A UTM value such as spring.sale or Summer Sale breaks the character rules and simply vanishes, with no error, so keep values to lowercase words joined by underscores or dashes. Our UTM builder flags spaces and stray characters before you paste a link into Stripe. And if the link keeps Stripe's own confirmation page, the UTM codes never reach your site at all. With redirect set, your success page loads with the UTM codes in its address, so the GA4 tag on that page can record the campaign.

Carrying click IDs to Google Ads, Meta and TikTok

Ad platforms tie server-side conversions back to ad clicks through their click IDs: gclid for Google Ads, fbclid for Meta and ttclid for TikTok. These arrive on your landing page URL, so your site must capture them when the visitor lands and carry them through checkout exactly like the GA4 client ID. For Checkout Sessions your server creates, store them in metadata. For Payment Links, which only carry client_reference_id, store the click IDs on your own server under a short visitor ID and have your site add that ID as client_reference_id to the link it sends the visitor to. A GA4 client ID contains a full stop, so it cannot go into client_reference_id unchanged.

From the webhook, the gclid can feed a Google Ads offline conversion import, and fbclid becomes the fbc value Meta's Conversions API expects, as explained in our guide to fbclid, _fbc and _fbp. If you also fire browser pixels on the success page, pass the same event ID to both so Meta and TikTok keep one copy. Stripe warns against putting sensitive information in client_reference_id, and the same applies to every parameter: never put an email address, name or phone number in a payment link URL. Our guide to keeping personal data out of URLs explains why.

Delayed payments and subscriptions

Some payment methods do not confirm straight away. Stripe says bank debits and vouchers can take 2 to 14 days. For these, checkout.session.completed arrives with payment_status unpaid, and checkout.session.async_payment_succeeded or checkout.session.async_payment_failed follows later. A success page cannot tell which way it will go, so it counts orders that may never be paid, and only the webhook knows the real outcome. You then have a choice:

  • Count the purchase when checkout completes, and send a refund for any payment that later fails, as in our guide to GA4 refund tracking.
  • Wait for async_payment_succeeded and accept that, after more than 24 hours, GA4 cannot join the purchase to the original session.
  • Use a separate event for pending orders, so bidding only learns from confirmed revenue.

Subscriptions need a different rule. The first Checkout Session produces checkout.session.completed once, while invoice.paid fires for every paid invoice, the first one and each renewal. Count the first payment as the acquisition conversion and keep renewals out of the purchase events your ad platforms optimise towards, or every renewal will look like a new customer won by whichever campaign is credited. If you offer a free trial, Stripe marks the session as paid once the zero-value trial invoice is processed, so decide whether a trial start is the conversion you want and give it an honest value.

Which pattern to choose

If you sell one-off products, pay mostly by card and have no developer, a success page with transaction IDs is a sound start. If you sell subscriptions, accept delayed payment methods or need every order counted, add the webhook: Stripe says webhooks are required for those cases. Many teams run both, with the browser pixel on the success page and the server event from the webhook sharing one event ID for Meta and TikTok, and GA4 receiving each purchase from one of the two. EndFrame fits the success page pattern: its snippet records the visit and its campaign on arrival, and a thank-you page goal or an endframe.track purchase event on your success page is credited to that campaign and forwarded server-side to Meta Conversions API, GA4 Measurement Protocol or TikTok Events API. It does not receive Stripe webhooks, so the webhook pattern stays with your own server.

Frequently asked questions

Can I add my GA4 tag or Meta Pixel to Stripe Checkout?

No. Hosted Checkout and Payment Links are pages Stripe runs. Their customisation options cover branding, such as fonts, colours and your logo, not your own scripts. That is why Stripe's GA4 guide fires events on your own product and success pages, or records the purchase on your server when the checkout.session.completed webhook arrives.

Why does my GA4 client ID disappear when I put it in client_reference_id?

A GA4 client ID contains a full stop, for example 1234567890.1234567890, and client_reference_id only accepts letters, numbers, dashes and underscores. Stripe silently drops invalid values rather than showing an error. Replace the full stop with an underscore and reverse it on your server, or store a short ID of your own instead.

Does the Payment Links analytics tab replace GA4 for conversion tracking?

No. The Payments and analytics tab on a payment link shows views, sales and revenue for that link, but Stripe says the data can be delayed by up to 18 hours, it is not available in a sandbox, and links with recurring prices are not supported. It tells you nothing about which campaign sent the buyer.

Try EndFrame

Add a server-side path for your conversions.

EndFrame collects events first-party and forwards conversions server-side to Meta, GA4, TikTok, and webhooks with event-ID deduplication — then credits each conversion to its campaign, with the visit-to-conversion path you can audit.

No credit card required

Keep reading