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:
- Call
newrelic.recordReplay()
, to initiate recording. - After the session is complete or consent is withdrawn, use
newrelic.pauseReplay()
to stop capturing data.
- Call
- 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 |
---|---|
|
|