---
title: Browser obfuscation rules
source: https://docs.newrelic.com/docs/streaming-video-&-ads/installation/browser/obfuscation-rules
---

Obfuscation rules let you mask sensitive data before the agent transmits it to New Relic. Each rule is a regex pattern paired with a replacement string. Rules are applied to the serialized JSON payload before transmission.

## Configuration [#configuration]

Pass an `obfuscate` array in the agent configuration:

```js
config: {
  obfuscate: [
    { regex: /\/user\/[^\/?"]+/, replacement: '/user/[REDACTED]' },
    { regex: /token=[^&"]+/, replacement: 'token=[MASKED]' },
  ]
}
```

## Parameters [#parameters]

| Field         | Type                 | Description                                      |
| ------------- | -------------------- | ------------------------------------------------ |
| `regex`       | `string` \| `RegExp` | Pattern to match in the serialized JSON payload. |
| `replacement` | `string`             | Replacement string for each match.               |

## Rule ordering [#rule-ordering]

Rules are applied sequentially — the output of one rule feeds into the next. Invalid regex patterns are skipped with a warning logged via `Log.warn`.
