Skip to main content
Clerk → BigQueryIntegration guide

Connecting Clerk to BigQuery

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. BigQuery has no attribution model, no deduplication rules and no opinion about your data — which makes it the only destination on this site where every number is exactly as good as the query that produced it. The join between them succeeds or fails on one thing: whether whatever join key you decide on reaches the Clerk user and organisation before the conversion happens, because BigQuery can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Clerk to BigQuery: modeling users, orgs and first-touch source

Load Clerk users, organizations and memberships into BigQuery from webhooks, backfill via the Backend API, and join billing on organization ID. Credit each paying org's creator's stored click IDs through a versioned view, deduplicate on the svix-id header, and convert epoch-millisecond timestamps once at load.

In BigQuery you can do what no ad platform will: attribute per organization while keeping every user's source. Load three tables from Clerk's webhooks: users (Clerk user ID, created time, and the UTMs and click IDs you stored in metadata), organizations (org ID, created time, creating user), and memberships (user ID, org ID, role, joined time). Backfill existing records once through Clerk's Backend API, then join billing on the organization ID.

The first-user rule becomes a query: for each paying org, take the creator or earliest member and credit its stored gclid, fbclid, rdt_cid or UTM source, listing every other member's source as supporting. Write that rule as a versioned view, because it will be argued about. The common break is duplicate rows: Clerk delivers webhooks through Svix and retries failures, so the same user.created payload can land twice. Deduplicate on the svix-id header, which should stay constant across retries (confirm in a test), before anything reads the table.

Clerk timestamps arrive as epoch milliseconds; convert them to TIMESTAMP once at load, or one table holds integers and another holds dates and every join by day drifts. Keep consent state as a column on users. This dataset then feeds everything else: offline conversion files for Google, Meta or Reddit become one query that emits one row per paying organization with the credited user's click ID.

Clerk → BigQuery · what breaks

Why this join usually fails — Clerk → BigQuery

  1. 01

    Whatever join key you decide on never reaches Clerk

    Several people from one company sign up separately, each carrying a different acquisition source.

  2. 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.

  3. 03

    The warehouse quietly disagreeing with every platform

    This is not a bug — it is the point. Your warehouse counts orders; Google counts click-attributed conversions in its window; Meta counts differently again. When the four numbers differ, the warehouse is usually right about revenue and wrong about attribution, and knowing which question you are answering is the whole skill.

  4. 04

    Nothing reconciles afterwards

    BigQuery will not tell you anything is wrong. Verify by querying the table directly against your source system's own totals, and check for duplicate rows on the join key before trusting any aggregate.

Clerk → BigQuery · the fix

What working looks like — Clerk → BigQuery

  • Whatever join key you decide on on every account

  • Conversions arriving in BigQuery

    The row lands in a table you own, joinable to every other table you own, with no window and no expiry.

  • Reconciled against the source

Clerk → BigQuery · architecture

How Clerk and BigQuery actually connect

  1. 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. 2

    BigQuery needs a click to match

    BigQuery needs a schema and consistent types. The failure mode is not rejection, it is silent divergence: a column that arrives as a string in one load and an integer in the next, or a timestamp in the wrong zone, which produces answers that look plausible and are not.

  3. 3

    The identifier is the bridge

    Whatever join key you decide on, captured at the visit and carried into the Clerk user and organisation.

  4. 4

    The event source decides reliability

    Send paid conversions per organisation, deduplicated across its users.

  5. 5

    Deduplication at the destination

    Nothing deduplicates for you. Streaming inserts are at-least-once, so a retried load can create duplicate rows, and the only protection is a deduplication step you write and actually run.

Clerk → BigQuery · normal or broken

Working vs. broken, side by side — Clerk → BigQuery

Normal, not a fault

  • Whatever join key you decide on present on the account

  • Sent from your billing system, keyed on the organisation

  • Deduplicated correctly

    Nothing deduplicates for you. Streaming inserts are at-least-once, so a retried load can create duplicate rows, and the only protection is a deduplication step you write and actually run.

  • Reconciles with the source

Actually broken

  • Whatever join key you decide on 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

    This is not a bug — it is the point. Your warehouse counts orders; Google counts click-attributed conversions in its window; Meta counts differently again. When the four numbers differ, the warehouse is usually right about revenue and wrong about attribution, and knowing which question you are answering is the whole skill.

  • Nobody has reconciled it

Clerk → BigQuery · diagnose

Diagnostic order — Clerk → BigQuery

  1. 01

    Count accounts carrying whatever join key you decide on

  2. 02

    Follow one real conversion end to end

  3. 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.

  4. 04

    Reconcile warehouse order counts against each platform for one closed window

    The gaps localize the problem: a gap against all platforms is a collection issue, a gap against one is that platform's window or matching.

  5. 05

    Read the match rate, not the success message

    BigQuery will not tell you anything is wrong. Verify by querying the table directly against your source system's own totals, and check for duplicate rows on the join key before trusting any aggregate.

Clerk → BigQuery · prove

How it gets proven — Clerk → BigQuery

Source of truth

Your billing system, joined to the Clerk organisation rather than the user.

  • Whatever join key you decide on confirmed present on a live account.
  • Warehouse order counts and revenue reconciled against the source system for a fully closed window, with duplicates checked on the join key.
  • Paid conversions reconciled per organisation against imported conversions, deduplicated across users.

Clerk → BigQuery · free audit

What we check in the free audit

  • Count accounts carrying whatever join key you decide on
  • Follow one real conversion end to end
  • Compare user signups against paying organisations
  • Reconcile warehouse order counts against each platform for one closed window
  • Read the match rate, not the success message

Checked against

Your billing system, joined to the Clerk organisation rather than the user.

Get my free conversion tracking audit

Free30 minutesNo obligation

Clerk → BigQuery · when not to buy

When you don't need this — Clerk → BigQuery

  • Measure identifier coverage yourself first — pull your last hundred accounts and count how many carry whatever join key you decide on.
  • Consumer products where one user is one customer do not have this distinction.
  • If you have one store and one ad platform, a warehouse is infrastructure you will maintain for a reconciliation you could do in a spreadsheet.

Clerk → BigQuery · what we deliver

What gets built — Clerk → BigQuery

  • 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 BigQuery

    Streaming inserts or scheduled batch loads from your order system, with the raw event retained alongside whatever you derive from it.

  • 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.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Clerk → BigQuery questions, answered

Subscribe to Clerk's user, organization and membership webhooks and write each payload to a raw table, then build clean tables from it. Backfill existing users once through Clerk's Backend API.

Free · 30 min

Get Clerk and BigQuery joined properly

Free30 minutesNo obligation