Signed-in people
Call identify with your own id for the person on every page while they are signed in:
dba('identify', '42')Their visits, pages, events, recordings and experiments then appear under People → 42, across devices. Never use an email address as the id (it is refused): use your database id.
Verified ids. Anyone can call identify from a browser's console, so ids without a signature are marked *unverified*. To mark them verified, sign a short token on your server with the site's identity secret (Settings → Site → Identity secret) and pass it as the second argument:
dba('identify', '42', '<token from your server>')The token is a standard HS256 JWT with sub (the id) and exp (at most 24 hours away). Our server packages make it in one line:
import { identityToken } from '@deltabreen/analytics-server'
identityToken(process.env.ANALYTICS_IDENTITY_SECRET, { id: user.id })from deltabreen_analytics import identity_token
identity_token(os.environ["ANALYTICS_IDENTITY_SECRET"], {"id": user.id})DeltaBreen\Analytics\Analytics::identityToken(getenv('ANALYTICS_IDENTITY_SECRET'), $user->id);Tokens signed for Help by DeltaBreen work too. docs/identity-vectors.json holds test cases every implementation reproduces.
What kind of customer they are. Put traits in the token, and every report can be filtered by them and every chart split by them: "time on page for people on the Pro plan", "orders by company size".
identityToken(process.env.ANALYTICS_IDENTITY_SECRET, { id: user.id, traits: { plan: user.plan, seats: user.seats } })identity_token(os.environ["ANALYTICS_IDENTITY_SECRET"], {"id": user.id, "traits": {"plan": user.plan, "seats": user.seats}})DeltaBreen\Analytics\Analytics::identityToken(getenv('ANALYTICS_IDENTITY_SECRET'), $user->id, traits: ['plan' => $user->plan]);Traits are read only from a token signed with your identity secret, never from the browser alone, so nobody can give themselves a plan from the console. Up to 30, each text, a number or true/false; null forgets one, and a trait left out stays as it was. A trait is never an email address, and names like email, phone or name are left out: keep traits to what kind of customer someone is, not who they are. Each is kept at its latest value and shown on the person's page. Your server can send them too, without a page view, through the people API (Pro and higher).
Forgetting someone. People → their page → *Erase*, or POST /api/users/<id>/erase, removes their events, the visits they were signed in on, their consented device ids, their traits and their recordings. It is done within minutes and recorded in the audit log.