JavaScript SDK ⁠-⁠ 'start' method

This method is used to start the tracker. By starting the tracker, the recording of the session starts.

start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>

The start method accepts an optional parameter where you can customize different aspects of the recording:

  • userID: string: used to manually set the user ID to track it across sessions. This is a string value and it can be anything you want.
  • metadata: Record<string, string>: manually set metadata values. Check the Metadata section to learn more about this feature.
  • forceNew: boolean: used to force a new session after page refresh. By default it’s set to false, so after a refresh the session is kept.
  • sessionHash: string: used for sticky sessions. Useful if you have a multi-site application or if you have to redirect the user outside and then back into your site (like to a payment gateway).

Once started, the method will return a promise with a session info object containing:

  • sessionID: string: A string value representing the ID of the started session. Starts the tracker (and the recording process) then returns a promise with session info (sessionID, sessionHash, userUUID).