• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Advanced features

Manually record session replays

If needed, you can programmatically force a session replay to start or stop recording using API methods. Here are some use cases:

  • Allow users to opt in for interaction recording. For example, if you have a pop-up asking "Allow this session to be recorded for performance analysis?" and a user consents:
    1. Call newrelic.recordReplay(), to initiate recording.
    2. After the session is complete or consent is withdrawn, use newrelic.pauseReplay() to stop capturing data.
  • Record sessions based on specific criteria, such as:
    • Start recording only for sessions on specific URLs such as a product checkout flow.
    • Stop recording for sensitive pages such as /billing or /health-records.

Refer the API documentation for instructions:

Disable automatic session replay tracking

You can prevent session replays from automatically starting, even when sampled, by setting the API configuration option autoStart to false. This is useful in scenarios where you need to prioritize specific actions over automatic sampling. For example, you might not want session replays to automatically run on sensitive pages, like HIPAA-compliant ones. In such cases, you can use the .start() API to manually trigger the replay feature after user consent is obtained (and your app calls .start())

Setting autoStart: false instructs the agent to defer its initialization until explicitly called using .start(). This ensures that session replays won't be created at all, even if the backend samples your application for recording.

Important

Calling .start() doesn't guarantee that a session replay will be recorded. It simply delays the module import and evaluation of sampling results until this point. If you need to force a recording, refer Manually record session replays.

To start using this API, refer newrelic.start.

Use Nerdgraph to configure replay settings

You can configure session replay settings using our NerdGraph API instead of using the UI. This method is helpful if you need to make bulk changes, such as applying sampling rates to multiple browser entities.

Here's an example mutation and variables to create a new browser application with default settings:

Mutation

Variables

mutation SessionReplayConfigUpdate(
$guid: EntityGuid!
$settings: AgentApplicationSettingsUpdateInput!
) {
agentApplicationSettingsUpdate(guid: $guid, settings: $settings) {
browserSettings {
sessionReplay {
blockSelector
errorSamplingRate
maskTextSelector
enabled
collectFonts
inlineImages
inlineStylesheet
samplingRate
maskAllInputs
maskInputOptions {
color
date
datetimeLocal
email
month
number
range
search
select
tel
text
textArea
time
url
week
}
}
}
errors {
field
errorClass
description
}
}
}
{
"sessionReplay": {
"enabled": true,
"collectFonts": true,
"blockSelector": ".private-fields",
"maskTextSelector": "*",
"inlineStylesheet": false,
"maskAllInputs": true,
"maskInputOptions": {
"color": true,
"date": true,
"textArea": true
},
"samplingRate": 9.99,
"errorSamplingRate": 1.11
}
}
Copyright © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.