Send the ad click IDs to Stripe alongside the UTM parameters - #323
Merged
Conversation
paulocastellano
force-pushed
the
feat/checkout-metadata-click-ids
branch
from
September 1, 2026 01:56
88667a7 to
9cec1d7
Compare
Signup already captures a click ID per ad network -- gclid, fbclid, li_fat_id, ttclid, rdt_cid, epik -- but only the UTM parameters reached the subscription. UTMs say which campaign a customer came from; the click ID identifies the individual click, which is what Google and Meta need to match a subscription back to the ad that produced it. Every key is spelled out at the call site, so what reaches Stripe is readable in one place without following a constant. Click IDs are text columns on purpose, since truncating them at 255 would destroy the value. Stripe caps a metadata value at 500 characters and rejects the request rather than truncating, so an unbounded column reaching it would fail the whole checkout and the customer could not subscribe at all. Values are cut to 500 before they are sent. The UTM columns are varchar(255) and cannot reach it; this exists for the text ones.
paulocastellano
force-pushed
the
feat/checkout-metadata-click-ids
branch
from
September 1, 2026 01:58
9cec1d7 to
80ffdc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #322, which sent the UTM parameters and onboarding answers to the Stripe subscription but left the ad click IDs behind.
UTM parameters say which campaign a customer came from. The click ID identifies the individual click — which is what Google Ads and Meta need to match a paying subscription back to the exact ad that produced it. Without it the attribution stops at campaign level and offline conversion import is not possible.
Signup already captures one per network, so this is purely a forwarding change:
gclidfbclidli_fat_idttclidrdt_cidepikEvery key is spelled out at the call site rather than mapped over a constant, so what reaches Stripe can be read in one place without following an indirection.
The 500-character cut is load-bearing here
Stripe caps a metadata value at 500 characters and rejects the request rather than truncating. A rejected request means the checkout session is never created and the customer cannot subscribe at all — silent lost revenue, triggered by whatever happened to be in their signup URL.
In #322 this could not happen: the UTM columns are
varchar(255). The click IDs are deliberatelytext—a3b85d19established that truncating them at 255 destroys their value — so they are unbounded and the ceiling is now reachable. Cutting at 500 on the way out trades a truncated click ID for a checkout that still works.Not included: X / Twitter
There is no
twclidcolumn, and nothing captures it at signup. Adding it is a migration plus capture wiring, not a metadata change, so it is out of scope here — worth its own PR if we run X ads.Tests
StartSubscriptionCheckoutTestcovers the full payload including all six click IDs, an owner with nothing filled in ([]), and a 900-characterfbclidarriving at Stripe as exactly 500.Full suite green: 4063 passed.