Identify signed-in users
Call identify after sign-in and reset on sign-out so visits, funnels and revenue are tied to real users.
Updated
By default every visitor is anonymous. When your app tells Boostra who a signed-in user is, their visits on every device join one profile in User Profiles, and payments that carry the same id are matched to them.
Call identify once the user is known#
Call it after login, after an OAuth redirect returns, after sign-up, and on app start when a session already exists:
window.boostra?.("identify", { userId: user.id, email: user.email });userIdis your stable internal id, such as a UUID or database id. Allowed characters are letters, digits and. _ : @ + -, up to 128 characters. Prefer an internal id over an email address.emailis optional. It is hashed in the browser before it is sent; the plain address is only sent when the snippet hasdata-identity-allow-email="true". An email used as theuserIdis replaced by its hash in the same way.traitsis optional and acceptsname,plan,company,roleandsignupAt.- Calling it again with the same id is harmless. A different id starts a new visitor.
Reset on sign-out#
window.boostra?.("reset");Call it only on a real sign-out. Calling it on every page load for anonymous visitors would start a new visitor each time.
A real example: Supabase Auth#
supabase.auth.onAuthStateChange((event, session) => {
if (session?.user) {
window.boostra?.("identify", { userId: session.user.id, email: session.user.email });
} else if (event === "SIGNED_OUT") {
window.boostra?.("reset");
}
});The same pattern works with Clerk, Firebase, Auth0 and NextAuth: identify when the auth library reports a user, and reset only when a signed-in user signs out.
Automatic recognition#
Without any code, the tracker also tries to recognize signed-in users from common auth libraries and from identify calls you already make to other tools. It never reads access tokens or passwords. To turn it off, add data-identity-auto="false" to the snippet. An explicit identify call always wins.
When sign-in happens on the server#
If your login completes on the server (cookie sessions, magic links, webhooks), identify from there instead: see Identify users from your server.
Never pass access tokens, refresh tokens, passwords, card data or whole user objects to Boostra.
Related articles
-
Identify users from your server
Link a visitor to a user from your backend with a secret identify key when sign-in finishes on the server.
Read article -
The window.boostra JavaScript API
Every command the tracking snippet exposes on window.boostra, with signatures and examples.
Read article -
User profiles and the visitor profile
See identified users and customers, and open any visitor's sessions, journey, orders and attribution.
Read article -
Link Stripe Checkout to visitors
Pass Boostra's visitor and session IDs into Stripe Checkout metadata so every payment is tied to the visit that produced it.
Read article