Connecting Clerk to Segment
Clerk handles both authentication and organisation membership, which matters for B2B products where the paying entity is a company and the signing-up entity is a person. Segment is a customer data platform rather than an ad network, so sending to it is not about matching a conversion — it is about putting one clean event where every other destination can read it. The join between them succeeds or fails on one thing: whether the userId and anonymousId reaches the Clerk user and organisation before the conversion happens, because Segment can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Clerk to Segment: identify on user ID, group on organization
Send Segment identify with userId as the Clerk user ID and group with groupId as the Clerk organization ID, from both server webhooks and the browser. Set analytics.js cookies on the root domain, pass anonymousId into signup metadata, and send paid conversion once per organization from billing with an invoice-based messageId.
Segment's spec has a call made for Clerk's model: identify for the person, with userId set to the Clerk user ID, and group with groupId set to the Clerk organization ID. Send both from the server when Clerk's user and membership webhooks fire, and from the browser when the session loads, with identical IDs. Destinations that understand accounts then receive company structure; destinations that do not still get clean users.
The anonymousId from your marketing site must be stitched to the Clerk ID. Because Clerk sign-in may happen on a hosted page or after an OAuth redirect, the browser that returns to your app can be on a different subdomain from the one that set the Segment cookie. Check that analytics.js sets its cookie on the root domain so www and app share it, and pass the anonymousId into sign-up metadata as a server-side fallback.
Click IDs and consent state go on the identify call as traits of the first user, and the paid conversion goes out as one track call per organization from billing, with a messageId built from the invoice ID so retries are idempotent. Check whether Clerk offers a direct Segment connection; the webhook route works either way, and it is the one that carries organization membership.
Clerk → Segment · what breaks
Why this join usually fails — Clerk → Segment
- 01
The userId and anonymousId never reaches Clerk
Several people from one company sign up separately, each carrying a different acquisition source.
- 02
Counting seats instead of customers
Five colleagues signing up from one company is one paying customer and five conversions if attribution sits on the user. Cost per acquisition then reads as a fifth of reality.
- 03
One bad event multiplied across every destination
Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.
- 04
Nothing reconciles afterwards
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
Clerk → Segment · the fix
What working looks like — Clerk → Segment
The userId and anonymousId on every account
Conversions arriving in Segment
Events land in Segment and forward to every connected destination, warehouse included, on one shared definition.
Reconciled against the source
Clerk → Segment · architecture
How Clerk and Segment actually connect
- 1
Clerk holds the truth
In B2B SaaS the subscription belongs to an organisation and several users belong to it. Attributing revenue per user counts one customer several times.
- 2
Segment needs a click to match
Segment needs a consistent identity model — the same userId everywhere, an alias when an anonymous visitor becomes known, and event names that follow one spec. Feeding it inconsistent identities pushes the mess to every connected destination at once.
- 3
The identifier is the bridge
The userId and anonymousId, captured at the visit and carried into the Clerk user and organisation.
- 4
The event source decides reliability
Send paid conversions per organisation, deduplicated across its users.
- 5
Deduplication at the destination
Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.
Clerk → Segment · normal or broken
Working vs. broken, side by side — Clerk → Segment
Normal, not a fault
The userId and anonymousId present on the account
Sent from your billing system, keyed on the organisation
Deduplicated correctly
Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.
Reconciles with the source
Actually broken
The userId and anonymousId missing on most records
Several people from one company sign up separately, each carrying a different acquisition source.
Sent from the browser
Five colleagues signing up from one company is one paying customer and five conversions if attribution sits on the user. Cost per acquisition then reads as a fifth of reality.
Counted twice, or not at all
Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.
Nobody has reconciled it
Clerk → Segment · diagnose
Diagnostic order — Clerk → Segment
- 01
Count accounts carrying the userId and anonymousId
- 02
Follow one real conversion end to end
- 03
Compare user signups against paying organisations
The ratio is the size of the overcount, and in B2B products it is rarely close to one.
- 04
Check identity resolution before checking anything downstream
If anonymousId is never aliased to userId, every destination sees two people where there is one, and no downstream fix helps.
- 05
Read the match rate, not the success message
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
Clerk → Segment · prove
How it gets proven — Clerk → Segment
Source of truth
Your billing system, joined to the Clerk organisation rather than the user.
- The userId and anonymousId confirmed present on a live account.
- An anonymous session confirmed aliased to a known user, with the event visible in at least one downstream destination.
- Paid conversions reconciled per organisation against imported conversions, deduplicated across users.
Clerk → Segment · free audit
What we check in the free audit
- Count accounts carrying the userId and anonymousId
- Follow one real conversion end to end
- Compare user signups against paying organisations
- Check identity resolution before checking anything downstream
- Read the match rate, not the success message
Checked against
Your billing system, joined to the Clerk organisation rather than the user.
Free30 minutesNo obligation
Clerk → Segment · when not to buy
When you don't need this — Clerk → Segment
- Measure identifier coverage yourself first — pull your last hundred accounts and count how many carry the userId and anonymousId.
- Consumer products where one user is one customer do not have this distinction.
- If you send to one or two destinations, Segment is infrastructure you do not need — direct integrations are simpler and cheaper. It earns its place at genuine fan-out.
Clerk → Segment · what we deliver
What gets built — Clerk → Segment
Identifier capture into Clerk
Store the identifier on the user and attribute at the organisation, using the first user's source with the others recorded as supporting.
Event source: your billing system, keyed on the organisation
Send paid conversions per organisation, deduplicated across its users.
Dispatch to Segment
Server-side track and identify calls with a stable messageId, consistent userId, and the click identifier carried as a trait or property.
Reversals where they exist
Cancellations reverse against the organisation.
Written guarantee
95%+ tracking accuracy
Measured against Your billing system, joined to the Clerk organisation rather than the user.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Clerk → Segment questions, answered
Yes, that is what it is for. Use the Clerk organization ID as groupId and send organization name, plan and member count as group traits.
Usually the browser identifies with the Clerk user ID while a server source uses email or an internal database ID. Use the Clerk ID everywhere.
Almost always because the userId and anonymousId never reached the Clerk user and organisation. Several people from one company sign up separately, each carrying a different acquisition source. Measure coverage before debugging the dispatch.
Segment identifies people by anonymousId before they are known and userId afterwards, and the alias between them is what stitches a session to a customer. Click identifiers travel as event properties or traits rather than as a matching key — Segment does not match anything itself, it forwards. That distinction changes the whole design: get the identity resolution right and every downstream destination inherits it.
Your billing system, keyed on the organisation. Send paid conversions per organisation, deduplicated across its users.
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
More on Clerk → Segment
- Stripe → SegmentConnecting Stripe to Segment
- PayPal → SegmentConnecting PayPal to Segment
- Shopify → SegmentConnecting Shopify to Segment
RELATED GUIDES
Where Clerk → Segment fits in the rest of your tracking
- Auth0 → SegmentConnecting Auth0 to Segment
- Firebase Auth → SegmentConnecting Firebase Authentication to Segment
- Supabase Auth → SegmentConnecting Supabase Auth to Segment
- Clerk → BigQueryConnecting Clerk to BigQuery
- B2BConversion tracking for B2B, from first touch to closed-won
- Okta → SegmentConnecting Okta to Segment
Free · 30 min
Get Clerk and Segment joined properly
Free30 minutesNo obligation
