Changelog

Changelog

Identify signed-in users with a prop or a hook

  • Developers
Share on X

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.

app/layout.tsx
<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.

components/identify-user.tsx
"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() and identify() call to the console, and warns once per page when no tracker script loaded. Pass debug to 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.

Start with 14 days free.No card required.