Connecting Clerk to Matomo
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. Matomo can be self-hosted with no third party in the chain, which makes it the one analytics destination where the data genuinely never leaves infrastructure you control. The join between them succeeds or fails on one thing: whether the first-party visitor ID reaches the Clerk user and organisation before the conversion happens, because Matomo can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Matomo User ID from Clerk, with the org as a custom dimension
Set Matomo's User ID to the opaque Clerk user ID after sign-in and add the active organization ID as a custom dimension. Send organization created and the first paid invoice to the HTTP Tracking API from your server, with the invoice ID as ecommerce order ID. Track any Clerk Account Portal subdomain under the same site ID.
Matomo's User ID feature fits Clerk directly: after sign-in, set the user ID to the Clerk user ID and Matomo links that person's visits across devices. Use the opaque Clerk ID rather than an email, since the user ID is visible in Matomo reports to anyone with access.
For B2B, add the active organization ID as a custom dimension so usage and conversion can be reported per organization. Send organization created and the first paid invoice to the HTTP Tracking API from your server, with the invoice ID as the ecommerce order ID and the admin's user ID; Matomo's order-ID dedup then stops a retried webhook from recording revenue twice.
The gap specific to Clerk is the hosted sign-in step. If you use Clerk's Account Portal, sign-up happens on an accounts subdomain, and unless your tracker runs there with a cookie domain covering both hosts, the funnel from landing page to account appears to break exactly at the conversion. Either use Clerk's embedded components on your own pages or track the portal subdomain under the same site ID, and test that the visitor ID survives the round trip.
Clerk → Matomo · what breaks
Why this join usually fails — Clerk → Matomo
- 01
The first-party visitor ID 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
Owning the pipeline means owning the outage
The advantage is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.
- 04
Nothing reconciles afterwards
Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.
Clerk → Matomo · the fix
What working looks like — Clerk → Matomo
The first-party visitor ID on every account
Conversions arriving in Matomo
The event lands in your own database and is queryable directly, including the raw log, which most analytics products do not expose.
Reconciled against the source
Clerk → Matomo · architecture
How Clerk and Matomo 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
Matomo needs a click to match
The site ID, the visitor identifier and the event or ecommerce order. Self-hosted instances additionally need the tracker endpoint reachable and the database keeping up, which hosted tools do not fail at.
- 3
The identifier is the bridge
The first-party visitor ID, 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
Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.
Clerk → Matomo · normal or broken
Working vs. broken, side by side — Clerk → Matomo
Normal, not a fault
The first-party visitor ID present on the account
Sent from your billing system, keyed on the organisation
Deduplicated correctly
Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.
Reconciles with the source
Actually broken
The first-party visitor ID 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
The advantage is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.
Nobody has reconciled it
Clerk → Matomo · diagnose
Diagnostic order — Clerk → Matomo
- 01
Count accounts carrying the first-party visitor ID
- 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 tracker reachability and database lag before debugging any tag
On self-hosted analytics the answer is infrastructure more often than instrumentation.
- 05
Read the match rate, not the success message
Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.
Clerk → Matomo · prove
How it gets proven — Clerk → Matomo
Source of truth
Your billing system, joined to the Clerk organisation rather than the user.
- The first-party visitor ID confirmed present on a live account.
- Orders reconciled against the Matomo ecommerce log with order-ID deduplication verified.
- Paid conversions reconciled per organisation against imported conversions, deduplicated across users.
Clerk → Matomo · free audit
What we check in the free audit
- Count accounts carrying the first-party visitor ID
- Follow one real conversion end to end
- Compare user signups against paying organisations
- Check tracker reachability and database lag before debugging any tag
- 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 → Matomo · when not to buy
When you don't need this — Clerk → Matomo
- Measure identifier coverage yourself first — pull your last hundred accounts and count how many carry the first-party visitor ID.
- Consumer products where one user is one customer do not have this distinction.
- If you have no privacy or ownership requirement and no team to run it, a hosted product removes the only real cost of this one.
Clerk → Matomo · what we deliver
What gets built — Clerk → Matomo
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 Matomo
The Matomo HTTP Tracking API, posted server-side from your order system.
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 → Matomo questions, answered
Call setUserId with the Clerk user ID after sign-in, not the email, and add the active organization as a custom dimension.
The Clerk Account Portal runs on a subdomain your tracker may not cover. Track that subdomain under the same site ID with a cookie domain spanning both.
Almost always because the first-party visitor ID 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.
Matomo sets its own first-party cookie and, when self-hosted on your domain, is not a third-party request at all. That means ad blockers and browser tracking-prevention affect it far less than a hosted analytics tag — one of the few genuine measurement advantages available under current privacy conditions.
Your billing system, keyed on the organisation. Send paid conversions per organisation, deduplicated across its users.
Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.
More on Clerk → Matomo
- Stripe → MatomoConnecting Stripe to Matomo
- PayPal → MatomoConnecting PayPal to Matomo
- Shopify → MatomoConnecting Shopify to Matomo
RELATED GUIDES
Where Clerk → Matomo fits in the rest of your tracking
- Firebase Auth → MatomoConnecting Firebase Authentication to Matomo
- Supabase Auth → MatomoConnecting Supabase Auth to Matomo
- Auth0 → MatomoConnecting Auth0 to Matomo
- Clerk → AmplitudeConnecting Clerk to Amplitude
- Clerk → Adobe AnalyticsConnecting Clerk to Adobe Analytics
- B2BConversion tracking for B2B, from first touch to closed-won
- Okta → MatomoConnecting Okta to Matomo
Free · 30 min
Get Clerk and Matomo joined properly
Free30 minutesNo obligation
