Trace
Tracking

Identify users

Tell Trace who a signed-in visitor is, so their sessions, events and traits appear under their name.

By default every visitor is anonymous. Once a visitor signs in, call identify and Trace shows their name, email and avatar on the Users and Sessions pages. Everything they did on that browser before signing in stays attached to them.

Identify a user

Call this once the person has signed in. Calling it on every page load is fine — the latest call wins.

window.datafast("identify", {
  user_id: "123",            // required: your own id for them
  name: "Ada Lovelace",
  email: "[email protected]",
  image: "https://example.com/ada.png",
  plan: "pro",               // anything else is a trait
  company: "Analytical Engines",
});
  • user_id is required; without it the call is ignored.
  • name, email and image set how the user is shown.
  • Every other key is a trait. Send a new value any time — each trait keeps its latest value. Traits are listed on the user's profile and in the Traits tab of the Users page.

If your code may run before the script has loaded, queue the call with the stub from Install the tracking script.

How identity works

  • Identity is stored per visitor — one browser. The same person on a laptop and a phone is two visitors until you identify both; each then shows the same name and user ID.
  • Visitors are recognised by a first-party cookie on your root domain, so www, blog and app subdomains of the same domain share one visitor.
  • To keep one identity across different domains (for example example.com and example-checkout.com), list the other domain in data-allowed-hostnames. Links between them then carry the visitor along.

Personal data

Identify sends the name, email and traits you pass to Trace. Only send what you need, mention it in your privacy policy, and use Delete user data to honour deletion requests.

On this page