The reliable way to track Stripe payments as ad conversions is from your server, not from a thank-you page. Capture the click IDs when the user signs up, store them against the customer, and when Stripe sends a webhook such as checkout.session.completed or invoice.paid, send the conversion to Google Ads and Meta with the stored IDs and the real amount. Track the trial and the first paid invoice as separate conversion actions, and bid on the one that represents revenue.
This is for agency owners, PPC managers and media buyers running ads for SaaS clients that bill through Stripe. It covers which Stripe events to use, storing click IDs, sending conversions to Google Ads and Meta, values, refunds, and testing before anything touches a live account.
Why the success page is not enough
Most SaaS setups start with a Google Ads tag and a Meta Pixel Purchase or Subscribe event firing on the page Stripe redirects to after checkout. It works in a demo. In production it drifts, for predictable reasons:
- The redirect is not the payment. Users close the tab, the redirect fails, or an ad blocker stops the tag. The payment still happens. The conversion does not.
- The page loads more than once. A refresh, a bookmark or a back-button visit fires the tag again. That is how accounts end up counting conversions twice.
- The money comes later. With a free trial, the first real payment happens days or weeks after checkout. No browser tag can see it.
- The checkout domain breaks attribution in GA4. Stripe-hosted Checkout runs on a Stripe domain, so the return visit can show up as a referral from Stripe unless you handle it. Our guide to GA4 cross-domain tracking and self-referrals covers the fix.
Stripe itself says subscription integrations need a webhook endpoint, because most subscription activity happens asynchronously. Ad tracking has the same problem, and the same answer.
The Stripe events that matter for ad tracking
Stripe sends dozens of event types. For conversion tracking you only need a handful. These names come from Stripe's own subscription webhooks documentation.
| Stripe event | When it fires | Use for ads |
checkout.session.completed | The customer finishes a Stripe Checkout session | Trial started, or one-off purchase. Carries the session's metadata and client_reference_id |
customer.subscription.created | A subscription is created; status can be trialing, active or incomplete | Trial started, if you check the status first |
invoice.paid | An invoice is successfully paid | First paid conversion. Check billing_reason so renewals are not counted as new customers |
charge.refunded | A charge gets a full or partial refund | Value adjustment in Google Ads |
A free trial with a card on file usually produces a zero-value invoice at signup, so invoice.paid can fire for $0. Filter on the amount paid as well as the billing reason. The first real charge after a trial is the one you want as the paid conversion.
Two delivery rules shape the handler. Stripe does not guarantee event order, and the same event can arrive more than once. Log each event ID and skip anything already processed. Return a 2xx response quickly and call the ad platforms from a queue.
Step 1: capture click IDs before checkout
A webhook has no browser, no cookies and no URL. The click data has to be saved before the user reaches Stripe, and be findable from the webhook.
What to capture
gclid, gbraid, wbraid. Google Ads click IDs from the landing page URL. Store whichever is present.
fbclid and the _fbc and _fbp cookies. Meta's documented fbc format is fb.1.creationTime.fbclid, with the creation time in milliseconds. If the cookie is missing but you have an fbclid, you can build fbc yourself. Do not change the case of the fbclid.
- UTM parameters. They do not drive bidding, but they let you report trials and revenue by campaign. Keep the naming consistent across campaigns.
- Email, and phone if you collect it. Hashed, these power enhanced conversions in Google Ads and improve match rates in Meta.
- Consent state. If the site uses a consent banner, record what the user agreed to so the server-side send respects it.
Click IDs land on the first page view, but users often browse before signing up. Save them to a first-party cookie or local storage on arrival and read them at signup. Same pattern as in our guide to lead source attribution in HubSpot and GoHighLevel.
Where to store them
The cleanest place is your own database, on the user or account record created at signup. Then pass your internal user ID into Stripe so the webhook can find it. There are two common ways:
client_reference_id on the Checkout Session. Set it to your user ID. It comes back on checkout.session.completed.
- Metadata. Add your user ID, and if you like the click IDs themselves, as metadata. For subscriptions, use
subscription_data.metadata when creating the Checkout Session so the values land on the Subscription object.
Metadata has rules that trip people up. Stripe allows 50 keys per object, keys up to 40 characters and values up to 500 characters. Metadata does not copy to related objects automatically, with a few exceptions. One useful exception: when a Subscription creates an Invoice, its metadata is copied to the invoice under parent.subscription_details.metadata as a one-time snapshot. So if you put the user ID on the subscription, your invoice.paid handler can read it without another API call. Metadata set only on the Checkout Session does not follow the subscription.
Step 2: split trial and paid into separate actions
A trial is not revenue. If the trial is the primary conversion, bidding optimizes for trial starts and will happily find people who never pay.
| Moment | Stripe trigger | Google Ads | Meta |
| Trial started | checkout.session.completed or customer.subscription.created with status trialing | Separate action, usually secondary | StartTrial |
| First paid invoice | invoice.paid with amount above zero and first-payment billing reason | Primary action for bidding | Subscribe or Purchase |
| Renewal | invoice.paid on a cycle billing reason | Usually not sent | Usually not sent |
There is a trade-off. Paid conversions are slower and rarer, and bidding needs volume. If the client gets only a handful a month, keep the trial as primary for a period while the paid action collects data as secondary, then switch once volume allows. Make that a decision with the client, not a default. In Google Ads, set primary and secondary per action under Goals, and check that the campaign's goals include the action you want it to bid on.
The StartTrial and Subscribe events are Meta standard events. Both accept value, currency and predicted_ltv. Purchase requires value and currency. Pick one paid event per client and stick with it, so the event used for campaign optimization does not change under the campaigns.
Step 3: send the conversion to Google Ads
For server-side Stripe conversions in Google Ads, you have two routes.
Offline conversion import with click IDs
Create a conversion action of the import from clicks type. When the webhook fires, send the stored gclid (or gbraid or wbraid), the conversion time, the value and currency, and a transaction ID.
Since June 15, 2026, new offline conversion import integrations go through the Data Manager API, not the Google Ads API. If you are building this for a new client today, build it on the Data Manager API, using its events.ingest method. Our Data Manager API guide has the field mapping, and Google's Data Manager API guide for Google Ads events is the reference. Points that matter for Stripe specifically:
- Use a stable
transactionId. The Stripe invoice ID for paid conversions, the subscription ID for trials. Duplicates from webhook retries then get absorbed, and later value restatements work.
- Use the event time, not the send time. Take the timestamp from the Stripe object and send it in RFC 3339 format.
- Validate before you send. The Data Manager API fails the whole request if one event is invalid. Use
validateOnly while building.
- Watch the click age. A paid conversion weeks after the click can fall outside the action's click-through window. Set the window to cover the trial length plus a buffer.
Without code, Data Manager in Google Ads can import a scheduled file, Google Sheet or warehouse table. A nightly export of paid Stripe invoices with click IDs works for many smaller SaaS clients.
Enhanced conversions for leads
Enhanced conversions for leads matches on hashed user data, such as email, not only on a click ID. Google recommends it for new setups, and it helps when click IDs are missing. Send the hashed email (normalized and SHA-256 hashed) alongside any click ID you have. The website side is covered in our enhanced conversions setup guide.
Step 4: send the conversion to Meta
Meta's side goes through the Conversions API from your server. For each conversion, send:
event_name. StartTrial, Subscribe or Purchase, as decided above.
event_time. Unix seconds. Meta rejects the whole request if any event in it is more than 7 days old, so a backlog or a stuck queue can lose a batch.
event_id. Stable and unique per conversion. The Stripe invoice ID or Checkout Session ID works well.
action_source. website for a checkout the user completed on the site. Meta also lists system_generated, which can fit a trial that converts automatically with no user action. Pick one rule per client and document it.
user_data. Hashed email, plus fbc, fbp, IP address and user agent captured at signup. More good identifiers means better matching. Our Event Match Quality guide explains which fields count most.
custom_data. value, currency, and predicted_ltv if you use it.
Deduplication when a Pixel event also fires
If the client keeps a browser Pixel event on the success page, for example StartTrial, and you also send StartTrial from the server, Meta counts it twice unless both share the same event name and event ID. Per Meta's deduplication documentation, the Pixel's eventID must match the server's event_id, and matching events are deduplicated within 48 hours.
The practical trick with Stripe: put the Checkout Session ID in the success URL using Stripe's {CHECKOUT_SESSION_ID} placeholder, read it on the success page, and use it as the Pixel eventID. The webhook uses the same session ID as event_id. For the paid conversion after a trial, there is no browser event, so there is nothing to deduplicate. Send it server-side only. More detail in our Meta CAPI deduplication guide.
Choosing the value: first payment or predicted LTV
This is a Value-Based Bidding decision, so agree it with the client in writing.
- First payment. The simplest option. Send the first paid invoice amount. An annual plan sends twelve months of revenue, a monthly plan sends one, which pushes bidding toward annual plans.
- Predicted LTV. Send a fixed expected lifetime value per plan, based on the client's own retention data. It only works if the numbers come from real churn, not a guess.
- Trial value. If the trial is a secondary action, the value matters less. If you bid on trials, use expected value: average first-year revenue multiplied by the client's historical trial-to-paid rate.
Stripe amounts are in the currency's smallest unit, so amount_paid of 4900 on a USD invoice is $49.00. Zero-decimal currencies such as JPY are the exception. Decide whether values include tax and discounts, and apply one rule everywhere.
Refunds, chargebacks and failed payments
Stripe sends charge.refunded for full and partial refunds and charge.dispute.created for disputes. What you do with them depends on the platform.
- Google Ads. With the Data Manager API, sending an event with the same
transactionId for the same conversion action restates its value. The conversion count does not change. Retractions are not supported on this path, so you cannot remove a conversion entirely. For a full refund, restate the value to zero or close to it, and accept the count stays.
- Meta. The Conversions API is built for sending events, not editing them. Handle refunds in reporting, or if they are frequent, send the paid conversion after the refund window passes, while still inside Meta's 7-day limit.
- Failed payments. Do not send anything on
invoice.payment_failed. Because you only send on invoice.paid, a trial that ends in a failed charge simply never becomes a paid conversion.
Testing in a Stripe sandbox
Never test against a live Google Ads or Meta conversion action with live Stripe data. Use a Stripe sandbox (or test mode) and the platforms' own test tools.
- Check the capture script. Load the landing page with a fake
gclid and fbclid in the URL. In GTM Preview mode or Tag Assistant, confirm the script stores them, then submit the signup form and check your database record.
- Forward webhooks locally. Run
stripe listen --forward-to with your local endpoint. The CLI prints a signing secret for local signature checks.
- Run a real sandbox checkout. Use test card 4242 4242 4242 4242. Events from
stripe trigger checkout.session.completed use fixture data with none of your metadata, so they test the handler, not the lookup. Run at least one full checkout through your own signup flow.
- Simulate the trial ending. Stripe test clocks advance time on a sandbox subscription. In the Dashboard, open the subscription and use Run simulation to move past the trial end and confirm the first paid
invoice.paid fires and your handler sends the paid conversion.
- Check Google. Send with
validateOnly set to true first. Once live, check the import diagnostics in Google Ads rather than trusting a successful API response.
- Check Meta. Copy the test code from the Test Events tab in Events Manager and send it as
test_event_code. Confirm the event appears, shows as server, and deduplicates against the browser event when both fire.
- Check GA4 if in scope. Use DebugView, and confirm a success page refresh does not create a second transaction.
Where agencies trip up
- Counting renewals as new customers. Every monthly renewal fires
invoice.paid. Without a billing_reason check, a client with 500 subscribers reports 500 conversions a month.
- Counting $0 trial invoices as paid. Filter on amount as well as event type.
- Losing the click ID between landing page and signup. If it is only read from the URL on the signup page, any user who browsed first has none.
- Metadata on the wrong object. User ID set on the Checkout Session only, then the
invoice.paid handler cannot find it a month later.
- Doing the API calls inside the webhook response. A slow ad platform call times out the webhook, Stripe retries, and without an event ID check you send the conversion again.
- Browser and server events with different IDs. Meta counts both. See our Meta duplicate events fix.
- Bidding on trials without telling the client. Trials go up, paid customers do not, and the client sees it in Stripe first.
Once it runs, compare Stripe with the ad platforms monthly. The numbers will not match exactly, but the gap should be stable. If it suddenly widens, something in the chain broke.
Build it yourself or use an attribution tool
Everything above can be built with a webhook handler and a small database table, and for most clients that is the cheapest path. It does need a developer who will own it when Stripe, Google or Meta change something.
If the client would rather pay for software than maintain code, SaaS attribution tools cover the same chain. Cometly, for example, connects to Stripe for revenue attribution and sends conversions back to Meta, Google and LinkedIn through their conversion APIs, with HubSpot and Salesforce sync for sales-led funnels. Whichever route you choose, the checks in this guide still apply: one conversion per payment, trial and paid kept apart, and real values tested in a sandbox before bidding changes.
Getting it fixed for a client
The work is usually the same for every SaaS client: a capture script, a webhook handler, two conversion actions per platform, and a value rule. If you want a second pair of eyes on a client's current setup before you change bidding, request a free tracking check and we will tell you what is missing and what to fix first.