Issue
I would like to use replays, but I need to make sure a user consents before recording has started.
Applies To
- Frontend JavaScript SDK users
Resolution
For the NPM package -
You can initialize the Replay integration after the user has provided consent. This means removing the replayIntegration()
from your initial Sentry.init()
and adding it back later. Once it has been added, recording will begin based on your sampling rates. Please refer to our docs here for a code example.
For the loader script -
You must delay loading the entire loader script until after the user consents. The loader script does not support initializing Sentry first with only error monitoring and then enabling replays later.