InvergeDocs

Identity & sessions

distinctId, sessionKey and deviceKey — how Nexus decides who did what, and when a session starts and ends.

Nexus correlates everything through three identifiers. Getting them right is the single most important part of an integration.

distinctIdsessionKeydeviceKey
AnswersWho is this?Which visit / app run?Which install?
Set byYou (identify)Client SDK, per launch or tabClient SDK, persisted
LifetimeForeverUntil 30 min idle, or the next launch on mobileUntil uninstall / storage clear
Server SDKsFrom context or per callForwarded from the client if you have itForwarded if you have it

Identify

Call identify as soon as you know who the person is (after sign-in, or on app start when a session is restored). Before that, telemetry is anonymous but still tied to the device and session — and once you identify, the session is attached to the person.

await Nexus.instance.identify('user_123',
    email: 'ada@example.com', name: 'Ada', traits: {'plan': 'pro'});

Nexus.instance.distinctId; // 'user_123'
Nexus.instance.reset();    // on sign-out: forget the person, new session

Traits are stored on the person (the subject) and are available to targeting in in-app messages, surveys and push segments.

How a session is chosen

  • 30-minute idle timeout. A session with no activity for 30 minutes is ended (its end time is the last activity, not the sweep time).
  • One running session per phone. The Flutter SDK mints a new sessionKey on every launch; when that new session starts, the device's previous session is ended. Browsers are exempt — tabs share a device but each has its own session.
  • Realtime keeps sessions alive. An open realtime connection refreshes its session every 5 minutes.

Server-side identity

Servers usually don't have a sessionKey — that's fine. Pass distinctId (directly, or through the SDK's ambient context / framework integration) and the backend attaches the server's telemetry to that person's most recent session. If your app forwards its session key to your API, pass it along as sessionKey for an exact match.

Seeing (anonymous) in the console?

The signal arrived without a distinctId, or before identify ran. On mobile, identify on app start when you restore a signed-in user, not only after an interactive sign-in.

On this page