Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/platforms/javascript/common/session-replay/privacy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,34 @@ Sentry.replayIntegration({

We also have [server-side PII scrubbing](/product/data-management-settings/scrubbing/server-side-scrubbing/) for this data. It looks for certain patterns such as American social security numbers, credit cards, and private keys.

### Example: Scrubbing URLs

By default, URLs are stored in both recording and replay events.

To scrub the URL in a recording event, use the above `beforeAddRecordingEvent`.

To scrub the URL in a replay event, use `addEventProcessor`:

```javascript
Sentry.addEventProcessor(event) => {
// Ensure that we specifically look at replay events
if (event.type !== 'replay_event') {
// Return the event, otherwise the event will be dropped
return event;
}

// Your URL scrubbing function
function urlScrubber(url: string) {
return url.replace(/([a-z0-9]{3}\.[a-z]{5}\.[a-z]{7})/, '[Filtered]');
}

// Scrub all URLs with your scrubbing function
event.urls = event.urls.map(urlScrubber);

return event;
});
```

### Deprecated Options

Note that the privacy API prior to version 7.35.0 has been deprecated and replaced with the options above. Please see the [Replay migration guide](https://github.com/getsentry/sentry-javascript/blob/master/packages/replay/MIGRATION.md#upgrading-replay-from-7340-to-7350---6645) for further information.