Skip to main content
Call crispstats.identify(userId, traits) when you know who is signed in. CrispStats sends an identify event with your user id and traits, then attaches the user id to every later event from that page. In the dashboard the visitor gets one identified profile under Visitors that shows their email trait and user id, and gathers their sessions and events from every device.
Without identify, a visitor is anonymous: a hash that changes every day (unless persistent visitors are on) and a generated name. CrispStats sets no cookie either way. Identifying users changes that privacy picture: read what changes under GDPR before you ship it.

Identify a user

1

Call identify on each page where the user is signed in

The user id lives in memory for the current page only. Call identify on every page load where you know the user, for example from your layout or after your session check:
The script loads with defer, so put the queue stub above the script tag. Without it, crispstats.identify does not exist yet when inline code runs. In TypeScript, use the stub and types from TypeScript.
2

Call it again after sign-in

In a single-page app, call identify as soon as sign-in succeeds. Events sent after the call carry the user id. Sessions recorded earlier under the same anonymous visitor id are linked to the user when the identify event is stored.
3

Check the visitor profile

Open Visitors in the dashboard and pick the Identified segment. Select the visitor to open their profile.

What identify does

Calling identify with an empty id does nothing. A second call with a different id replaces the first for the rest of the page. There is no call to clear the id. After a user signs out in a single-page app, the id stays on events from that page until it reloads, so reload or navigate with a full page load on sign-out if that matters to you.

Arguments

string
required
Your own stable id for the user, such as a database id. Numbers are converted to strings. Up to 200 characters.
object
Flat properties to store on the profile, such as email, plan or company. They follow the same rules as custom event properties: strings are cut at 500 characters, keys are up to 60 characters, and at most 40 are kept.
Keep user ids at 200 characters or fewer. The id is sent with every event after identify, and the collector drops browser events with a longer id without an error, so an oversized id stops all tracking on that page.

How identified visitors appear

On the visitor’s profile:
  • Identity. The heading is a generated name, as for every visitor. Under it, the email trait is shown with the user id next to it. Without an email trait, the user id is shown. Anonymous visitors show “Anonymous visitor” instead.
  • Traits. Traits from each identify call are merged and stored with the profile. When a key is sent again, the newest value wins. The dashboard shows only the email trait; the identify event itself, with all its traits, appears in the visitor’s journey.
  • History. Once a visitor id is tied to a user id, sessions recorded earlier under that visitor id belong to the same person. Because anonymous visitor ids change daily, this links the visits from the same day, not from earlier days. With persistent visitors on, the anonymous profile is folded into the identified one.
  • One profile per user id. Visits from different devices or days that identify with the same user id add up on one profile: first seen, last seen, sessions, pageviews, events and lifetime revenue.
In the Visitors list, the Identified segment shows only visitors with a user id, and search matches their user ids and email traits. The user id and traits you send are stored with the profile. Send only what you need to recognise the user, and see data collected for what CrispStats stores on its own.

What changes for privacy

Anonymous CrispStats data is built so that it does not identify anyone: no cookies, a visitor id that changes every day, no IP address stored. identify deliberately breaks that for the visitors you call it for.
  • The data becomes personal data. Your user id ties events to a person in your own database, so under the GDPR and the UK GDPR the identified visitor’s events, profile and traits are personal data, even without an email address. An email trait makes it directly identifying.
  • Visits are linked over time. One profile gathers a user’s sessions from every device and day, which anonymous visitors never are.
  • You need a legal basis, and to say so. Name analytics of signed-in users in your privacy policy, and list CrispStats among the services that process it. Whether you need consent depends on your basis: many teams rely on legitimate interest for product analytics of their own signed-in users, others ask for consent. identify itself stores nothing on the device: the questions it raises are about the data collected, not about cookies.
  • Honour requests. When a user asks you to delete their data or stops consenting, stop calling identify for them. To remove what was stored, write to hello@crispstats.com with the site and the user id: the dashboard and API have no delete for a single visitor yet.
  • Send less. Prefer an opaque id over an email address as the user id, and send only the traits you use.
This describes what the feature does with data, not legal advice. See compliance for the rest of the picture.

Does identify count toward your plan

No. Only pageviews and custom events count toward your plan’s monthly events. An identify call sends an identify event, which is not counted, and neither are revenue, engagement pings, web vitals or errors. See what counts as an event.

Identify from your server

From your server, send an identify event over HTTP with a secret API key, with your user id in i, the visitor id you saved from crispstats.id() in vid, and the traits in p:
Send i with any server-side event to attribute it to the same user. See server-side events.

Next steps

Visitors

Browse visitor profiles, segments and journeys.

Server-side events

Send events for a user from a webhook, a cron or a background job.

Visitor id at checkout

Attribute payments to the visit that led to them.
Last modified on November 18, 2026