LinkTrace docs

NextAuth: track after your app resolves the final authenticated user

NextAuth can sit behind credentials, email links, or social providers. LinkTrace only needs the final success point and request attribution context.

Signup tracking

Call the helper after your app creates the user and establishes the auth state.

ts
import { trackNextAuthSignup, fromExpressRequest } from "@finndean/linktrace-node"

await trackNextAuthSignup(
  linktrace,
  fromExpressRequest(req),
  { user },
  { eventName: "signup" },
)

Login tracking

Track login at the point your application knows the login has succeeded.

ts
import { trackNextAuthLogin, fromExpressRequest } from "@finndean/linktrace-node"

await trackNextAuthLogin(
  linktrace,
  fromExpressRequest(req),
  { user },
  { eventName: "login" },
)
Related guides