Skip to main content
Call identify() with your own user ID to tie a visitor’s activity to a known person. This makes people-level reports exact across devices and sessions. A signed-in user on a phone and a laptop counts as one user, instead of the two you’d get from cookieless estimation. You choose the ID, and tinyanalytics keys every people report on it.

Why identify users?

Without identification, tinyanalytics counts visitors with a cookieless hash, which is a close estimate that can split one person across devices or merge several people on one network (see how tinyanalytics works). When you know who someone is — because they signed in — identify() replaces that estimate with your exact ID, so Users, Retention, and Cohorts all agree and follow the real person.

Identify a signed-in user

Call identify() once you know who the visitor is, typically right after they log in:
When you call identify(), tinyanalytics:
  • Attaches your ID to the visitor’s recent activity — it backfills the last 30 days of that visitor’s events, so their earlier anonymous visits are credited to the person.
  • Remembers the ID in the browser (localStorage), so the visitor stays identified across page loads and future sessions on that device.
  • Merges any traits you pass onto the person’s profile.

Which identity methods are available?

tinyanalytics exposes four identity methods on window.tinyanalytics:

What does tinyanalytics store when you identify a user?

The cookieless hash tinyanalytics uses for anonymous visitors is never stored on the device and contains no personal data. Identification is different: the user ID and traits you pass are stored so they can describe a person over time. Choose what you send accordingly:
  • Use a stable, internal ID — your database user ID, for example — not something that changes.
  • Avoid putting personal data you don’t want to keep into the ID or traits. If you don’t want to store email addresses, don’t pass them.
An identify() call fired in the same instant as a pageview may not tag that exact pageview — the backfill applies to events that are already saved. In practice this is a single event at the very start of a visit; all subsequent activity is attributed correctly.

Verify it’s working

1

Sign in and identify

Trigger your identify() call in the browser — usually by logging into your app.
2

Find the person in Users

Open the Users report in tinyanalytics. The visitor now appears under your ID, with their traits and their earlier activity attributed to them.
Identification is working when the visitor appears in the Users report under your own ID, with their traits and their earlier activity attributed to them.

Frequently asked questions

Yes. When you call identify(), tinyanalytics backfills the last 30 days of that visitor’s events, so their earlier anonymous visits are credited to the person. One exception: an identify() call fired in the same instant as a pageview may not tag that exact pageview, because the backfill applies to events that are already saved.
Call window.tinyanalytics.clearUserId(). It forgets the identified user on that device. tinyanalytics otherwise remembers the ID in the browser’s localStorage, so the visitor stays identified across page loads and future sessions.
Yes. The user ID and any traits you pass to identify() are stored so they can describe a person over time, and the ID is kept in the browser’s localStorage. This differs from the cookieless hash used for anonymous visitors, which is never stored on the device and contains no personal data.
No. tinyanalytics counts visitors with a cookieless hash without any code from you. That count is a close estimate that can split one person across devices or merge several people on one network. Call identify() when you know who someone is to replace the estimate with your exact ID.

Track custom events

Send named events that tie to the identified person.

How tinyanalytics works

Cookieless identity and how identify makes counts exact.

Configure the script

Control what the script tracks.

Verify your setup

Confirm identification is arriving.