![]() |
VOOZH | about |
When instrumenting a Browser RUM application, set the sample rate for the total amount of user sessions you want to collect and the percentage of user sessions collected that include Browser RUM & Session Replay capabilities.
This guide provides an example of how to customize the amount of Browser RUM & Session Replay sessions you want to collect from the total amount of user sessions in Datadog.
The sessionReplaySampleRate parameter is a percentage of sessionSampleRate.
This feature requires the Datadog Browser SDK v3.0.0+.
sessionReplaySampleRate initialization parameter, deprecating the premiumSampleRate and replaySampleRate initialization parameter.sessionReplaySampleRate initialization parameter default value is 0. Previous versions of the SDK use 100.Two initialization parameters are available to control how the session is tracked:
sessionSampleRate controls the percentage of overall sessions being tracked. It defaults to 100%, so every session is tracked by default.sessionReplaySampleRate is applied after the overall sample rate, and controls the percentage of sessions tracked as Browser RUM & Session Replay. From Datadog Browser SDK v5.0.0, it defaults to 0, so no session is tracked as Browser RUM & Session Replay by default.To track 100% of your sessions as Browser RUM:
To track 100% of your sessions as Browser RUM & Session Replay:
Use the slider to set the percentage of Browser RUM & Session Replay sessions collected from the percentage of total user sessions collected for your application.
If you set sessionSampleRate to 60 and sessionReplaySampleRate to 50, 40% of sessions are dropped, 30% of sessions are collected as Browser RUM, and 30% of sessions are collected as Browser RUM & Session Replay.
From v5.0.0, to track 100% of the sessions that reach a custom state as Browser RUM & Session Replay:
datadogRum.init({
....
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
startSessionReplayRecordingManually: true,
});
// when the custom state is reached
datadogRum.startSessionReplayRecording()
With the use of startSessionReplayRecordingManually: true, sessions that do not call startSessionReplayRecording() are considered as Browser RUM.
For more information about tagging and exploring attributes, see Browser Monitoring.
Additional helpful documentation, links, and articles:
| |