---
title: "Identify people when they sign in"
description: "Call identify() at sign-in and reset() at sign-out, so one person's visits before and after signing up are counted as one person."
canonical: "https://www.togohq.ai/docs/guides/identify"
applies_to: "@togohq/sdk-browser 1.x"
updated: "2026-11-03T00:00:00Z"
---

# Identify people when they sign in

Call identify() at sign-in and reset() at sign-out, so one person's visits before and after signing up are counted as one person.

## At sign-in: `identify()`

Once you know who the user is — after sign-in, after sign-up, and on every page load of a
signed-in session — pass your own id for them:

```ts
analytics.identify(user.id);
```

- **Use a stable id you already have**: your database's user id. Not an email address, not a
  username a person can change.
- **Calling it again with the same id does nothing**, so calling it on every page load of a signed-in
  session is safe and is the easiest way to never miss one.
- **The first `identify()` on a browser merges** its anonymous history into that user, so the
  visit before sign-up and the activity after it are one person.

## At sign-out: `reset()`

```ts
analytics.reset();
```

`reset()` starts a new anonymous visitor on this browser. Without it, everything the next person
on the same browser does — a shared laptop, a family tablet — is credited to the user who just
left, and nothing can separate them afterwards. It keeps the device id, so "was this the same
browser" stays answerable.

If a different user signs in without a sign-out in between, `identify()` with the new id resets
first on its own: a sign-in as somebody else is a sign-out that was missed.

## Do not identify too early

Call `identify()` only once the user has really signed in. Identifying from a form field before
the account exists, or with an id the user typed, merges the visitor into the wrong person, and
merges cannot be undone.

## The same id on the server

Events your server sends name the person on every call. Use **the same `userId`** there, or each
user becomes two people:

```ts
// server
analytics.track('subscription_renewed', { plan: 'pro' }, { userId: user.id });
```

See [Send events from your server for the right person](/docs/guides/server-events).

## Telling Togo about the person

`identify()` takes only the id. To record an email, a name or a plan, use
[`setPersonProperties()`](/docs/guides/person-properties) — never an event property. Why it
matters: [People and identity](/docs/concepts/people).
