Next.js + NextAuth
Tracks signups in a Next.js app that uses NextAuth (Auth.js), from a route on your server.
What it does
- A route on your server reads the click cookie and sends the lead after sign-in.
- Each customer’s lead is recorded once, so a later sign-in adds nothing.
- Clicks and sales work as in the Next.js guide.
Set up in three steps
- Install
@affitor/sdkand wrap your app inAffitorProviderwith your program ID, as in the Next.js guide. - Add the user ID to the session, and a route that reads the
affitor_click_idcookie and callstrackLead. - Call that route once from the browser after sign-in. Use the same user ID at sale time.