Skip to main content

How can I tell if a Session Replay was started automatically or manually?

Issue

I am setting up Session Replay and I want to tell whether a replay started from replaysSessionSampleRate or replaysOnErrorSampleRate, or from a manual Replay API call such as start() or startBuffering().

Applies To

  • All SaaS Customers and Self-Hosted Users

  • Web Session Replay

  • JavaScript SDK

Resolution

You can only tell in the Sentry UI when both sample rates are set to 0. In that setup, every recorded replay was started manually. If either sample rate is greater than 0, the UI does not mark whether recording started from sampling or from a manual API call.

If both sample rates are 0

Configure Replay for manual control only, as in the manually starting Replay documentation:

Sentry.init({
dsn: "...",
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0,
integrations: [Sentry.replayIntegration()],
});

const replay = Sentry.getReplay();
replay.start(); // session mode
// or: replay.startBuffering(); // buffer mode

Open the replay in Replay Details, then open the Tags tab. Confirm both of these values are 0:

  • sdk.replay.sessionSampleRate

  • sdk.replay.errorSampleRate

replay_manual.png

[Screenshot: Replay Details Tags tab showing sdk.replay.sessionSampleRate set to 0 and sdk.replay.errorSampleRate set to 0]

Because sampling cannot start a replay when both rates are 0, those values mean the replay was started with the manual Replay API.

If either sample rate is greater than 0

There is no separate tag or field for “manual start.” The Tags tab still shows your configured sample rates. If you stop an automatically recording session and then call start() or startBuffering(), that later replay looks the same in Tags as an automatically sampled one. You cannot distinguish them in the UI.

To control which sessions record under your own conditions, see How to conditionally enable Session Replay and the Understanding Sessions documentation.

Did this answer your question?