Next.js + Clerk

Tracks signups from Clerk’s user.created webhook in a Next.js app.

What it does

  • Your server sends the lead from the user.created webhook, which settles it.
  • The click reaches the webhook through the Clerk user’s metadata, since a webhook has no browser cookie.
  • Clicks and sales work as in the Next.js guide.

Set up in three steps

  1. Install @affitor/sdk and wrap your app in AffitorProvider with your program ID, as in the Next.js guide.
  2. Before sign-up completes, store the click ID on the Clerk user with signUp.update({ unsafeMetadata }).
  3. In your user.created webhook, call trackLead with the Clerk user ID and that click ID. Use the same ID at sale time.

Read the full guide: Next.js + Clerk guide

More integrations