> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RUM privacy

> Keep sensitive browser data out of RUM events and DOM session replay.

Apply privacy controls in the browser so sensitive values never reach the network. Start with the
default masked mode and allow additional content only after reviewing the recorded result.

## Privacy-safe defaults

```ts theme={null}
initRum({
  applicationId: 'checkout-web',
  clientToken: 'msrum_your_client_token',
  site: 'https://molesignal.example.com',
  defaultPrivacyLevel: 'mask',
  trackUrlQueryString: false,
});
```

With these defaults:

* URL query strings and fragments are removed;
* keys such as `password`, `secret`, `token`, `authorization`, `cookie`, `api_key`, and credit-card
  fields are recursively redacted from context;
* interaction labels and raw error stacks are withheld in masked mode;
* DOM text is masked during session replay;
* all input and `contenteditable` values remain masked, including when visible page text is allowed.

<Warning>
  Field-name redaction is a safety net, not a data-classification system. Do not add credentials,
  payment data, health data, or unnecessary personal information to user or custom context objects.
</Warning>

## Block or mask DOM content

The SDK recognizes privacy attributes without application-specific recorder code:

```html theme={null}
<section data-molesignal-block>
  <!-- The entire subtree becomes a placeholder. -->
</section>

<span data-molesignal-mask>Account holder name</span>

<div data-molesignal-ignore>
  <!-- Mutations and events for this element are ignored. -->
</div>
```

Replace the default selectors when needed:

```ts theme={null}
sessionReplay: {
  blockSelector: '.payment-form, [data-private-panel]',
  maskTextSelector: '.customer-name, [data-molesignal-mask]',
  ignoreSelector: '.animation-layer, [data-molesignal-ignore]',
},
```

Use blocking for secrets or large sensitive widgets, masking for text whose layout is useful, and
ignoring for noisy elements that have no investigation value.

## Allow visible page text carefully

Set `defaultPrivacyLevel: 'allow'` only after marking every sensitive region. Input values are still
masked, and the configured `maskTextSelector` plus `contenteditable` elements remain masked.

```ts theme={null}
defaultPrivacyLevel: 'allow',
sessionReplay: {
  blockSelector: '[data-molesignal-block], .payment-details',
  maskTextSelector: '[data-molesignal-mask], .customer-identity',
},
```

## Control URLs and network collection

Keep `trackUrlQueryString: false` unless the application guarantees that queries never contain
identifiers or secrets. Exclude sensitive routes or network endpoints before collection:

```ts theme={null}
excludedUrls: [
  '/account/security',
  /^https:\/\/api\.example\.com\/private\//,
  (url) => url.includes('/token-exchange'),
],
```

`allowedTracingUrls` controls which origins can contribute trace context. The option does not enable request
or response body capture; the SDK records timing and sanitized URL metadata.

## Review before production

<Steps>
  <Step title="Record a controlled test session">
    Exercise sign-in, checkout, profile, search, and error flows with non-production test data.
  </Step>

  <Step title="Inspect every event surface">
    Review session metadata, action names, URLs, error stacks, custom context, and DOM replay.
  </Step>

  <Step title="Add selectors and exclusions">
    Block sensitive subtrees and exclude routes that do not need collection.
  </Step>

  <Step title="Repeat after UI changes">
    Treat privacy selectors as production configuration and test selector behavior after markup changes.
  </Step>
</Steps>

<Card title="Session replay" icon="video" href="/en-US/rum/session-replay">
  Configure DOM recording after defining the privacy boundary.
</Card>
