- Block — the element is replaced with a blank placeholder in the recording. Its contents are never sent to Milana.
- Mask — the element’s text or input value is replaced with masked placeholders. The element’s structure stays visible, but its text and input values are not.
- Ignore — user interactions on the element (clicks, inputs) are not recorded, but the element’s content is still visible in the replay.
alt, title, href, and src.
Passwords (
input[type="password"]), phone numbers (input[type="tel"]), and email addresses (input[type="email"]) are always masked and cannot be revealed.Default CSS classes
The easiest way to apply privacy controls is to add a CSS class to the element in your HTML or JSX. The SDK respects these classes out of the box, with no additional configuration required.| Class | Effect |
|---|---|
milana-block | Element is blocked — replaced with a placeholder, contents not recorded |
milana-mask | Text content and input values are replaced with masked placeholders |
milana-unmask | Reveals matching elements at high or xhigh, unless another privacy rule masks or blocks them |
milana-ignore | User interactions on the element are not recorded |
Block an element
Mask text content
Mask an input
Ignore interactions
Custom classes and selectors
If you cannot use the default class names, configure your own via theprivacy option when initializing.
- React
- Script Tag
The selector-based options (
blockSelector, ignoreSelector, maskSelector, unmaskSelector) are matched against elements while the page is being recorded. Complex selectors can affect page performance — prefer simple, specific selectors.Full example
- React
- Script Tag
Masking levels
The controls above mask individual elements. If you would rather mask everything by default and reveal only the elements you trust, raise themaskingLevel.
| Level | Input values | DOM text |
|---|---|---|
normal (default) | Masked only when explicitly marked | Masked only when explicitly marked |
high | All masked | Masked only when explicitly marked |
xhigh | All masked | All masked |
- React
- Script Tag
Reveal trusted elements
Athigh or xhigh, add the milana-unmask class or use unmaskSelector to reveal elements that are safe to record — navigation, buttons, headings, translated product copy, and other non-sensitive UI:
- React
- Script Tag
milana-unmask, unmaskClass, and unmaskSelector only reveal what the masking level masked. They never override an explicit mask (milana-mask, maskSelector), a blocked element (milana-block, blockSelector), or an always-masked input type (password, tel, email). Those stay masked no matter what.
If you set a custom unmaskClass, it replaces the default milana-unmask class. Set unmaskClass to an empty string ("") to disable class-based unmasking.
Layout-preserving masking
By default, masking is implemented by replacing each character with*. Enable shouldUseLayoutPreservingMasking to replace masked text with width-matched placeholders that keep replays closer to the page’s original layout.
It is recommended to enable this for applications that mask long text, especially when using high or xhigh masking.
- React
- Script Tag
Layout-preserving masking changes how masked content is rendered, not which content is masked. It may preserve approximate word widths, hyphen positions, and line breaks. Use the
milana-block class when an element should be recorded as a blank placeholder instead.