Skip to main content

Session replay for web

Overview​

Session Replay for Web enables you to capture, visualize, and analyze real user sessions within your web applications. By recording user interactions (including clicks, page navigation, and input events) Session Replay provides a playback of user journeys, helping you quickly identify issues, optimize user experience, and accelerate troubleshooting. With Coralogix, you benefit from secure, privacy-conscious recording, configurable sampling, and seamless integration with your existing RUM data, ensuring actionable insights without compromising performance or compliance.

How it works​

The Session Replay recorder is part of the RUM Browser SDK, whether NPM or CDN.

The recording tool captures a snapshot of the browser’s DOM by actively monitoring and logging events occurring on a web page, including but not limited to DOM modifications, mouse movements, clicks, input events, and their respective timestamps.

Coralogix then reconstructs the web page and re-implements the recorded events at the appropriate moments in the replay view.

Configuration​

1.

Ensure that the following URLs are allowed in your Content Security Policy (CSP):

CSPURL
Script Source (script-src)https://cdn.rum-ingress-coralogix.com/coralogix/browser/
https://cdnjs.cloudflare.com/ajax/libs/pako/
The recording worker loads its compression library from the Coralogix CDN and falls back to cdnjs. Allow both.
Connect Source (connect-src)https://ingress.<eu1 | eu2 | us1 | us2 | ap1 | ap2>.rum-ingress-coralogix.com
Select the domain associated with your Coralogix account.
2.

Configure Session Replay as follows:

CoralogixRum.init({
// ...
sessionRecordingConfig: {
enable: true, // Must declare.
/**
* If autoStartSessionRecording is false, you can manually start & stop your session recording.
* Refer to Recording Manually Section.
**/
autoStartSessionRecording: true, // Automatically records your session when SDK is up.
recordConsoleEvents: true, // Will record all console events from dev tools. Levels: log, debug, warn, error, info, table etc..
sessionRecordingSampleRate: 100, // Percentage of overall sessions recording being tracked, defaults to 100% and applied after the overall sessionSampleRate.
},
});

Configuration options​

Settings​

Below are the settings you can configure at the root level of your Browser SDK using init({}) for Session Replay configuration:

KeyDefaultDescriptionRequired
blockClass'rr-block'A string or RegExp to redact all elements with this class. These elements will not be recorded but will replay as placeholders with the same dimensions.
blockSelectornullA string to specify which selector should be blocked. Select an element (e.g., h1) in the DOM.
ignoreClass'rr-ignore'A string or RegExp to ignore all events on elements with this class. Input events on these elements will not be recorded.
ignoreSelectornullA string to specify which selector should be ignored. Ignore an element (e.g., h1) in the DOM.
ignoreCSSAttributesnullAn array of CSS attributes that should be ignored.
maskTextClass'rr-mask'A string or RegExp to mask all elements with this class. The text of these elements will be masked with asterisks.
maskTextSelectornullA string to specify which selector should be masked. Choose an element in the DOM to mask.
maskAllInputsfalseMasks all input content as * .
maskInputOptions{ password: true }Masks certain types of input as *. By default, password inputs are masked.
maskInputFn-Function to customize the masking logic for input content recording. Pass a function to this property. Each time it masks, it calls your function and uses its logic.
maskTextFn-Function to customize the masking logic for text content recording. Same as above with text.
recordCanvasfalseWhether to record the canvas element. Options: false, true.
recordAfter'load'If the document is not ready, the recording starts after the specified event fires. Options: DOMContentLoaded, load.
sampling-Ignore certain interactions/events - such as mousemove - to reduce storage size. Sampling code snippets can be found below.
If not specified, all sampling options will default to true and will be recorded.
inlineImagesfalseWhether to record the content of images.
collectFontsfalseWhether to collect fonts as they appear on the website.
enable-Boolean to enable or disable session recording.required
autoStartSessionRecording-Boolean to automatically start session recording.required
recordConsoleEventsfalseBoolean to record console events.
excludeDOMOptionsSlimDOMOptions to remove unnecessary parts of the DOM. If you don't want to record script tags, specify here.
sessionRecordingSampleRate100Percentage of sessions being recorded, applied after the overall sample rate.

Sampling​

Rely on the following examples for your sampling configuration.

This example presents general configuration options.

CoralogixRum.init({
//...
sessionRecordingConfig:{
sampling: {
// record all mouse movements
// if set to false, no mouse movements will be recorded
mousemove: true,

// record all mouse interactions
// if set to false, no mouse interactions will be recorded
mouseInteraction: true,

// set the interval of a scrolling event
scroll: 150, // does not emit twice in 150ms
//if not declared, all scrolling events will be emitted

// set the interval of a media interaction event
media: 800, //if not declared, all media events will be emitted

// set the timing of record input
input: 'last',
// When inputting multiple characters, only record the final input
// Selecting 'all' instead of 'last' will record all typed inputs

// set how canvas content is captured, when recordCanvas is true
canvas: 'all'
// 'all' records every canvas call
// a number between 1 and 60 captures that many image snapshots per second instead
// has no effect unless recordCanvas is set to true
}
}
});


This example presents the different mouse interactions that may be configured.

CoralogixRum.init({
//...
sessionRecordingConfig:{
sampling: {
// Configure which kinds of mouse interaction should be recorded
mouseInteraction: {
MouseUp: true,
MouseDown: true,
Click: true,
ContextMenu: true,
DblClick: true,
Focus: true,
Blur: true,
TouchStart: true,
TouchEnd: true,
},
},
}
});


Privacy and security​

To protect your users’ privacy and sensitive information, elements containing specific class names are blocked or masked in recordings, as follows:

CoralogixRum.init({
// ...
sessionRecordingConfig: {
// ..
blockClass: 'rr-block', // Use a string or RegExp to redact all elements that contain this class, defaults to rr-block.
ignoreClass: 'rr-ignore', // Use a string or RegExp to Ignore all events that contain this class, defaults to rr-ignore.
maskTextClass: 'rr-mask', // Use a string or RegExp to mask all elements that contain this class, defaults to rr-mask.
maskAllInputs: false, // Mask all input content as * (Default false), refer to Input types.
maskInputOptions: { password:true } // Mask some kinds of input as *, By Default the SDK masking password inputs.
},
});

For example:

<div class="rr-block">Dont record me</div>
ElementAction
.rr-blockThe element will not be recorded. It will replay as a placeholder with the same dimension.
.rr-ignoreThe element will not record input events.
.rr-maskAll text of elements will be masked.

Manage session recordings​

Start and stop recordings​

To manually start and stop recordings, use the following code snippet:

// To start manually the Session Recording
CoralogixRum.startSessionRecording();

// To stop the Session Recording
CoralogixRum.stopSessionRecording();

Avoid performance impact​

Session Replay works by recording incremental DOM changes in your web application. On a page that changes constantly, use these options to reduce how much is captured:

  • sampling throttles high-frequency events. Setting mousemove: false, a scroll interval, and input: 'last' cuts the bulk of the event volume on most applications. See Sampling.
  • excludeDOMOptions removes parts of the DOM you don't need from every snapshot. For example, excludeDOMOptions: { script: true } drops script tags.
  • sessionRecordingSampleRate records a percentage of sessions rather than all of them. For example, sessionRecordingSampleRate: 50 records half of them.
Note

Earlier SDK versions stopped recording when a burst of DOM mutations exceeded a maxMutations limit. That limit was removed in version 3.0.2 because it produced incomplete recordings, and maxMutations no longer has any effect. Remove it from your configuration.

Getting started​

1.

Click on the play icon of a specific user session in the User Sessions Grid or error in the Error Grid.

2.

You will be redirected to the SESSION REPLAY tab.

Replay screen​

The Replay Screen offers users a dynamic interface to relive recorded sessions with advanced control options, ensuring a seamless and insightful playback experience.

  • Play & Pause: Users can effortlessly control the playback by pausing and resuming the video at their convenience

  • Speed Control: The replay speed can be adjusted to suit user preferences

  • Interaction Focus: Skipping directly to stages with user interactions enhances efficiency.

  • 0-Second Skip: The ability to skip forward and backward by 10 seconds offers precise navigation.

Console​

The Console presents users with an immersive environment to explore recorded sessions comprehensively, combining various elements for an enriched understanding of user interactions and application behavior. Observe Console output - your application's internal logs and messages - in sync with user actions.

Data usage​

To reduce costs and lessen the network load caused by Session Replay, Coralogix compresses the data before sending it. Coralogix eases the strain on a browser's user interface thread by assigning CPU-heavy tasks, like compression, to a separate web worker.

We apply the following logging pipeline to Session Replay data:

Logs prioritySent dataUnits
Low (Compliance)1 GB0.12

Limitations​

Session Replay records up to one hour of activity.

Troubleshooting​

Part of the replay is blank, black, or freezes​

A replay that plays normally but freezes or shows a blank or black region is usually content the recorder does not capture rather than a lost recording. Playback continues on either side of it.

A stretch where the image is frozen on the last frame shown means the recording has no events to record for that period. That happens both when the user was genuinely inactive and when data for that stretch never arrived.

CauseWhat you seeWhat to do
Video and audio content is not recorded. The recorder captures playback state - whether the element is playing, its current time, playback rate, volume - but never the frames themselves.The player area is blank for as long as the video is on screen. On a full-screen player this is the whole viewport, typically for the length of the video.Expected behavior. Use the surrounding events and the recorded playback state to follow what the user did.
The recording has no events for this period. The recorder emits on change, so a stretch where nothing changes produces nothing to replay.The image freezes on the last frame drawn while the playhead keeps advancing.Usually brief idleness. However, since a period of idleness longer than 15 minutes ends the session, a longer freeze points to missing data.
Canvas content is not recorded by default. recordCanvas defaults to false.Any canvas-rendered view replays empty - charts, WebGL, map and drawing surfaces, in-canvas video, PDF viewers.Set recordCanvas: true. Capturing canvas content increases recording size, so combine it with sampling.canvas.
An element is blocked. Elements matching blockClass (default rr-block) or blockSelector are replaced by a placeholder of the same dimensions.A fixed-size empty region wherever the blocked element sits, for as long as it is on the page.Expected behavior. If the blank area is larger than you expect, check whether a container higher up the tree carries the block class.
Cross-origin iframe content is not recorded.The iframe area is empty.Expected behavior.

The replay stops partway through and does not resume​

If the replay ends early rather than gapping, recording was stopped. Once stopped, it does not restart for the remainder of that session - a later session is recorded as a new replay.

CauseHow to confirmWhat to do
A recording segment failed to upload.The browser console shows Coralogix Browser SDK - Error while sending record.Check that your Content Security Policy allows https://ingress.<eu1 | eu2 | us1 | us2 | ap1 | ap2>.rum-ingress-coralogix.com for your domain, and that a proxy or ad blocker is not blocking the request.
The compression worker could not start.The browser console shows Coralogix Browser SDK - Web worker not created due to missing pako library.Allow both script source URLs listed under Configuration.
Recording is not supported on the platform.With debug: true, the browser console shows Coralogix Browser SDK - Recording is not supported on this platform, which means the browser does not expose Worker.Recording cannot run in that environment.
The session ended. A session ends after one hour, or after 15 minutes without user activity.The activity continues under a new session ID.Expected behavior. Look for the rest of the activity in the following session.
Note

Set debug: true in CoralogixRum.init({}) to log each time recording starts and stops, along with the reason.

Playback freezes at a page reload​

On older SDK versions, a session kept across a page refresh with keepSessionAfterReload could restart its recording segment numbering, which freezes playback at the point of the reload. Current versions carry the numbering across the refresh. Upgrade to the latest SDK version.

Additional resources​

Session Replay in Coralogix RUM
Last updated on