03Tracking
Identify users
Associate visits with a signed-in user, and end an identity on logout.
By default every visitor is anonymous. Call identify after sign-in to attach your own user ID, and optionally a name, to the visits and events that follow. This does not change the anonymous visitor boundary: it adds identity information to the same visitor.
Identify
<script>
window.insightflare.identify("user-123", { name: "Alice" });
</script>userIdis trimmed and cut to 255 characters. An empty ID is ignored.nameis optional, trimmed, and cut to 255 characters.- The ID and name are attached to all later page views, leaves, visibility changes, and custom events.
- If a visit is already in progress, an identify event is sent immediately. Calling
identifybefore the first page view is also supported: the identity is attached to the visit when it starts.
Identified users appear as User ID and User name in session and visitor details, and you can filter by user.id and user.name (see filters).
Reset on logout
window.insightflare.reset();
window.insightflare.identify("user-456", { name: "Bob" });reset():
- Ends the current visit with the exit reason
identity_reset. - Clears the identified user ID and name.
- Rotates the browser's visitor ID, which creates a new anonymous visitor boundary. In privacy modes without a stored visitor ID, no ID is stored.
- Starts a new visit on the current page.
Call reset() when the user signs out and before switching accounts. Calling identify("user-456") alone does not create a new visitor boundary, so events from the new account would remain attached to the previous visitor.