InvergeDocs
JavaScriptAPI reference

Sessions

Sessions in the JavaScript SDK.

// access
nexus.sessions
SymbolKindSummary
IdentifyOptionsinterface
NexusSessionsclassThe sessions spine — names the end-user and starts/refreshes the journey.

IdentifyOptions

interface

email

property
email?: string

name

property
name?: string

phone

property
phone?: string

End-user phone number (E.164 recommended).

traits

property
traits?: Record<string, unknown>

NexusSessions

class

The sessions spine — names the end-user and starts/refreshes the journey.

NexusSessions

constructor
new NexusSessions(http: NexusHttp, id: NexusIdentity, cfg: ResolvedConfig)

Parameters

Prop

Type

Returns NexusSessions

View source

identify()

method
async identify(distinctId: string, options: IdentifyOptions = {}): Promise<void>

Identify the current end-user; all later telemetry is attributed to it.

Parameters

Prop

Type

View source

track()

method
async track(context?: Record<string, unknown>): Promise<string | null>

Start/refresh the active session; returns the server session id.

Parameters

Prop

Type

Returns Promise<string | null>

View source

reset()

method
reset(): void

Forget the user (e.g. on logout) and start a fresh session.

View source

On this page