If you use Stripe Checkout or Payment Links, you have a tracking problem.
The checkout happens on Stripe's domain. Your pixels never see it. The customer lands on your thank-you page, and all you have is a session ID – no revenue, no items, no customer data, no cookies, no browser context.
Most solutions make it worse. Webhooks give you order data but zero session context. Node.js proxies require infrastructure you shouldn't need. Zapier workflows give you partial data at best. And some blog posts suggest exposing your Stripe secret key client-side – don't do that.
There is a better way.
One sGTM client template + one JS snippet on your thank-you page. That's the entire setup.
Here is the full flow:
?session_id={CHECKOUT_SESSION_ID} in the URL.Your Stripe secret key never leaves the server. The browser only sends the session ID and cookies.
| The key difference from webhooks: because the request comes from the customer's browser on your thank-you page, you get real session context. GA4 sees the purchase as part of the same session. No orphaned conversions. |
The template extracts everything useful from the Stripe session and maps it to GA4 and Meta CAPI format: _epik
| Category | Fields |
|---|---|
| Ecommerce | transaction_id, value, currency, tax, shipping, coupon, payment_type, items[] |
| User data | Email, phone, first name, last name, billing address, business name |
| Session stitching | client_id, ga_session_id, ga_session_number, ip_override,user_agent, page_location, page_referrer |
| Consent | Google Consent State, DMA flag, no-personalized-ads signal |
| Ad platform cookies | _ga, _fbp, _fbc, _ttp, li_fat_id, _gcl_aw, _epik, Klaviyo, affiliate networks, and more |
Because this setup runs on Stape, you can easily extend it with features that are otherwise complex to build.
The JS snippet natively collects Stape cookies and 30+ ad platform cookies. If you want to go further, Stape's Cookie Keeper power-up extends the lifespan of those cookies to 2 years, protecting attribution against Safari's ITP restrictions, which otherwise expire client-side cookies in 1-7 days.
Hash the customer's email at purchase time and store it as a document key in Stape Store with a purchase_count.
On the next purchase, look it up:
purchase_count is 1 or higher, it's a returning customer. You can send this signal directly to Google Ads and Meta, significantly improving bidding efficiency.
Read the full guide on Stape Store customer tracking.
Store the original session stitching data (client ID, session ID, etc.) in Stape Store alongside the hashed email. When the same customer makes a subsequent purchase – an upsell, a renewal, a repeat order – you can retrieve that data and re-stitch the new event into the correct user journey, even without a live browser session.
For cancellations and refunds, Google Ads is the only major platform that supports post-conversion adjustments. Store the transaction_id at purchase time and use the Google Ads Conversion Adjustments tag to retract or reduce the value when an order is canceled.
Comments