Overview
Session Replay expands your user experience monitoring by allowing you to capture and visually replay the web browsing experience of your users. Combined with RUM performance data, Session Replay is beneficial for error identification, reproduction, and resolution, and provides insights into your web application’s usage patterns and design pitfalls.
The RUM Browser SDK is open source and leverages the open source rrweb project.
Session Replay recorder
The Session Replay recorder is part of the RUM Browser SDK. The recorder takes a snapshot of the browser’s DOM and CSS by tailing and recording events happening on a web page (such as DOM modification, mouse move, clicks, and input events) along with these events’ timestamps.
Datadog then rebuilds the web page and re-applies the recorded events at the appropriate time in the replay view. Session Replay follows the same 30 day retention policy as normal RUM sessions.
The Session Replay recorder supports all browsers supported by the RUM Browser SDK with the exception of IE11. For more information, see the browser support table.
To reduce Session Replay’s network impact and ensure the Session Replay recorder has minimal overhead on your application’s performance, Datadog compresses the data prior to sending it. Datadog also reduces the load on a browser’s UI thread by delegating most of the CPU-intensive work (such as compression) to a dedicated web worker. The expected network bandwidth impact is less than 100kB/min.
Setup
Session Replay is available in the RUM Browser SDK. To start collecting data for Session Replay, set up Datadog RUM Browser Monitoring by creating a RUM application, generating a client token generation, and initializing the RUM Browser SDK. For setup in mobile environments, see Mobile Session Replay.
Session Replay is supported by SDK version 3.6.0 or later.
Usage
Starting with v5.0.0 of the RUM Browser SDK, the Session Replay starts recording automatically when calling init()
. To conditionally start the recording, use the startSessionReplayRecordingManually
init parameter and call startSessionReplayRecording()
.
For example, to only record authenticated user sessions:
window.DD_RUM.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
startSessionReplayRecordingManually: true,
...
});
if (user.isAuthenticated) {
window.DD_RUM.startSessionReplayRecording();
}
To stop the Session Replay recording, call stopSessionReplayRecording()
.
When using a version of the RUM Browser SDK older than v5.0.0, Session Replay recording does not begin automatically. Call startSessionReplayRecording()
to begin recording.
Force Session Replay
In some scenarios, you may want to begin recording a session after it has already started, even if it was initially sampled out of replay. For instance, you might want to force Session Replay on a newly deployed page for closer monitoring, or start recording after detecting an error to ensure complete replay data.
To force Session Replay recording for the rest of the current session, call startSessionReplayRecording({ force: true })
When using the force option, the session is upgraded to a replayed session for the remainder of its duration, regardless of its initial sampling decision.
Disable Session Replay
To stop session recordings, set sessionReplaySampleRate
to 0
. This stops collecting data for the Browser RUM & Session Replay plan.
If you're using a version of the RUM Browser SDK previous to v5.0.0, set replaySampleRate
to 0
.
Retention
By default, Session Replay data is retained for 30 days.
To extend retention to 15 months, you can enable Extended Retention on individual session replays. These sessions must be non-active (the user has completed their experience).
Extended Retention only applies to Session Replay and does not include associated events. The 15 months start when Extended Retention is enabled, not when the session is collected.
You can disable Extended Retention at any time. If the session replay is still within its default 30 days of retention, the replay expires at the end of the initial 30 day window. If you disable Extended Retention on a session replay that is older than 30 days, the replay immediately expires.
Refer to the below diagram to understand what data is retained with extended retention.
Playback history
You can see who has watched a given session replay by clicking the watched count displayed on the player page. This feature allows you to check whether someone you’d like to share the recording with has already watched it.
The history includes only playbacks that occurred in the player page or in an embedded player, like in a Notebook or side panel. Included playbacks also generate an Audit Trail event. Thumbnail previews are not included in history.
To view your own playback history, check out the My Watch History playlist.
Mobile Session Replay
Learn more about the Session Replay for Mobile.
Further Reading
Additional helpful documentation, links, and articles: