JavaScript SDK ⁠-⁠ 'coldStart' method

Begins buffering messages without starting the actual session. The buffer will keep the last 30 seconds of recorded events. You can activate the session by calling start() or via a conditional trigger.

coldStart(startOpts?: Partial<StartOptions>, isConditional?: boolean): Promise<void>

With the startOpts you can customize different aspects of the recording:

  • userID: string: Used to manually set the userID to track it across sessions. This is a string value and it can be anything you want.
  • metadata: Record<string, string>: Manually set the metadata values. Check the Metadata section to learn more about this.
  • 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).
  • isConditional: Decides if the tracker should wait for the trigger condition to be met before starting the session automatically.

Note: Conditional recording is only supported in our Cloud and Enterprise Edition offerings.

This method does not return any value.