JavaScriptAPI reference
Sessions
Sessions in the JavaScript SDK.
// access
nexus.sessions| Symbol | Kind | Summary |
|---|---|---|
IdentifyOptions | interface | |
NexusSessions | class | The sessions spine — names the end-user and starts/refreshes the journey. |
IdentifyOptions
interfaceemail?: stringname
propertyname?: stringphone
propertyphone?: stringEnd-user phone number (E.164 recommended).
traits
propertytraits?: Record<string, unknown>NexusSessions
classThe sessions spine — names the end-user and starts/refreshes the journey.
NexusSessions
constructornew NexusSessions(http: NexusHttp, id: NexusIdentity, cfg: ResolvedConfig)Parameters
Prop
Type
Returns NexusSessions
identify()
methodasync identify(distinctId: string, options: IdentifyOptions = {}): Promise<void>Identify the current end-user; all later telemetry is attributed to it.
Parameters
Prop
Type
track()
methodasync 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>
reset()
methodreset(): voidForget the user (e.g. on logout) and start a fresh session.
View source