Recording UUIDs
To start recording, a UUID needs to be created. This can be created in the browser at recording time using crypto.randomUUID(). Or it can be created server-side and passed to the client. This UUID should be unique for each recording recorded, and should be used consistently throughout the recording.
The recording UUID is used to group all events and metadata for a particular recording together in the database.
Example
const recordingId = crypto.randomUUID();Multiple Tabs = Multiple Recording UUIDs
If a user opens multiple tabs of the same application, each tab should ideally have its own unique recording UUID. This allows for accurate tracking of user behavior in each tab separately. And prevents data from different tabs from being mixed together.
When a new tab is opened, generate a new recording UUID for that tab. This can be done by checking if a recording UUID already exists in the tab's context (e.g., in sessionStorage, localStorage, or a cookie). If not, generate a new one.
let recordingId = sessionStorage.getItem('recordingId');
if (!recordingId) {
recordingId = crypto.randomUUID();
sessionStorage.setItem('recordingId', recordingId);
}To keep track of a recording that spans multiple tabs, you should give each tab its own recording UUID. Then, you can link these recording UUIDs together using a common user identifier attached to the recording by storing it in the application metadata.
Recording metadata
The recording UUID can be used to store metadata before or during the recording of a recording. This metadata can include information such as user identifiers, application state, or any other relevant context that should be associated with the recording. See the recording metadata documentation for more details on how to use this feature.