Web analytics

Identify signed-in users

Pass the signed-in user to identify to measure retention and returning visitors. The ID is hashed in the browser and never leaves it.

Anonymous visitors get a new ID every day, so retention and returning visitors are measured for identified users only. Once your app knows who is signed in, pass their user ID to identify.

Call identify

The identity lives in memory only, so call it on every page load, and call it with null when the user signs out.

On every page load, once the user is known
window.logdash?.identify(user.id);
On sign-out
window.logdash?.identify(null);

The script is deferred, so your app can know the user before it has loaded. If window.logdash is still undefined at that point, call identify from the load event of the script element.

What identify accepts

  • id is a string or a number. null, undefined or an empty string clears the identity, and events tracked after that are sent without a user ID.
  • A value that contains @ or is longer than 256 characters is ignored with a console warning and leaves the identity as it was, so an email address is never sent by mistake.
  • Events of the page load that are still waiting to be sent when the hash is ready get the user ID too, so the first pageview is attributed when identify follows within about a second.

Pass a stable internal ID, never an email address or a name.

How the ID is hashed

The tracker hashes the ID in the browser as sha256(siteId + ':' + id), so the raw ID never leaves it. Hashing needs crypto.subtle, which browsers offer only in secure contexts such as HTTPS pages. Without it, identify does nothing.

Your apps can pass the same user as userId with their own events, and the server computes the same hash, so one user is one person across your website and apps. Web analytics and privacy has the details.