Changelog
Identify signed-in users with a prop or a hook
- Developers
Pass the signed-in user's id to <Highseat /> and the package calls identify() whenever it changes. null means signed out, so a sign-out or an expired session clears the id.
<Highseat site="YOUR_SITE_ID" userId={user?.id ?? null} />From a hook
When the session comes from a client hook, call useIdentify() in any component instead. The root layout never reads the session, so a Next.js layout can stay static.
"use client"import { useIdentify } from "highseat/next"import { useSession } from "~/lib/auth-client"export function IdentifyUser() { const { data, isPending } = useSession() useIdentify(isPending ? undefined : (data?.user.id ?? null)) return null}
undefined means the session is still loading and changes nothing. null means signed out and clears the id.
Improvements
- In development, the package logs every
track()andidentify()call to the console, and warns once per page when no tracker script loaded. Passdebugto turn it on or off anywhere. - An identified user id is kept in the browser for 13 months from the day it was set, then dropped. Identifying again with the same id doesn't extend it.
Fixes
- Funnels count a visitor's steps before and after
identify()as one person. - Sign-in and checkout hosts such as accounts.google.com and checkout.stripe.com fold into Direct instead of showing as sources.
- Revenue in Icelandic króna, Ugandan shillings and Malagasy ariary is stored at the right scale, from Stripe and from Polar.