JavaScript SDK - 'startOfflineRecording' method
Starts session recording in offline mode (nothing being sent unless triggered to upload) returns methods to control the recording state.
Note: The session and events timestamps will be extracted from the user’s device, and not synchronised with our backend.
Signature
Section titled SignaturestartOfflineRecording(
startOpts?: Partial<StartOptions>,
onSessionSent: () => void
): { saveBuffer, getBuffer, setBuffer }Parameters
Section titled ParametersWith the startOpts you can customize different aspects of the recording:
userID: string: Used to manually set theuserIDto 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 feature.forceNew: boolean: Used to force a new session after page refresh. By default it’s set tofalse, 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).onSessionSent: Callback that will be called once session is fully uploaded.
Return value
Section titled Return valuesaveBuffer(): void- Saves the current buffer to thelocalStorageobject (customizable in constructor), buffer will be autoloaded oncestartOfflineRecordingis called.getBuffer(): Messages[]- Returns the current messages buffer.setBuffer(buffer: Messages[])- Replaces the current buffer with the given one (if you’re using alternative temporary saving methods).