BeaconDocsDashboard

Sending data

Identify users

Beacon counts visitors anonymously. When someone signs in to your site, tell Beacon your ID for them, and their visits link to that user from then on.

Identify someone

js
// After someone signs in, with your own ID for them
beacon('identify', 'user_8f3a2c');

From then on, every event from this browser carries that user ID, and the visitor's earlier visits are linked to it too. In Sessions you can search for the ID and follow everything they did. Beacon remembers it in this browser, so calling it once after sign-in is enough; calling it on every page is also fine.

In an app
// Wherever your app knows who is signed in
if (currentUser) {
  beacon('identify', currentUser.id);
}
Use your own internal ID, not an email address or name. The ID is stored as it is, and an ID means nothing to anyone who shouldn't see who it is.

On sign-out

js
// When they sign out
beacon('reset');

This forgets the user ID and the anonymous visitor ID in this browser, stops any session recording, and starts a fresh anonymous visitor. Call it when someone signs out, so the next person on a shared computer isn't counted as them.

Across devices

Each browser starts as its own anonymous visitor. When the same person signs in on their phone and their laptop, both carry your user ID from then on: search for it in Sessions to find their visits from every device. Experiments and feature flags can also split by user, so someone sees the same version on every device. See the reference for every command.