UserProof / Free tools / Hide sensitive data
Hide sensitive data in session replay: the masking snippet for 8 tools
For founders who build with a coding agent: no two of these 8 tools use the same marker, so a card field masked for Hotjar is still visible to Clarity. Paste your selector below, copy the line for your tool, and hand it to Claude Code, Codex or Cursor to add to your templates.
Make the snippet
Example result Selector #card-number, .chat-editor · Hide the content, keep the clicks
| Tool | Add to the element in your HTML | Or by selector, no markup change |
|---|---|---|
| UserProof | <input id="card-number" data-exclude> | <script defer src="https://ingest.getuserproof.com/sdk.js" data-site="YOUR_SITE_ID" data-exclude="#card-number, .chat-editor"></script>List the selectors in the script tag's own data-exclude attribute; no markup change. |
| Microsoft Clarity | <input id="card-number" data-clarity-mask="True"> | #card-number, .chat-editorIn the Clarity dashboard's masking settings, list the CSS selectors to mask. |
| Hotjar | <input id="card-number" data-hj-suppress> | No selector setting on the page we read. |
| FullStory | <input id="card-number" class="fs-mask"> | The doc names Privacy Settings in the FullStory app as the other route. |
| PostHog | use the selector route | posthog.init("YOUR_KEY", { session_recording: { maskTextSelector: "#card-number, .chat-editor" } })maskTextSelector in posthog.init takes a CSS selector. It masks text, not input fields. |
| LogRocket | Not offered: LogRocket's doc says clicks on an element marked data-private are not directly detected. | |
| OpenReplay | <input id="card-number" data-openreplay-obscured> | No selector setting on the page we read. |
| Mouseflow | <input id="card-number" class="mf-masked mf-listen"> | #card-number, .chat-editorIn Mouseflow Website Settings, enter the CSS selector (an ID, class or CSS path). The code article also points to its Visual Privacy tool. |
Check the selector on your page first: open the console and run document.querySelectorAll("#card-number, .chat-editor").length. 0 means it matches nothing.
How to read the result
Each row is one recorder. The middle column is the marker to put on the element in your HTML; the example tag is built from the first selector you typed, so #card-number becomes <input id="card-number" …>. The right column is the route that needs no markup change, where the tool documents one: UserProof's script tag, PostHog's maskTextSelector setting, Clarity's dashboard and Mouseflow's Website Settings take a CSS selector directly.
A row with no snippet means the tool's docs do not offer that strength. LogRocket has no keep-the-clicks option: its doc says clicks on an element marked data-private are not directly detected. UserProof and Clarity have no leave-it-out option: both mask the content and keep the element.
What the 8 docs say
- No two of the 8 tools share a marker name. A site that changes recorders, or runs two at once, has to mark every private field again for each one.
- 4 of the 8 take a CSS selector without editing the element: UserProof (the script tag), PostHog (
maskTextSelector, text only), Microsoft Clarity (the dashboard) and Mouseflow (Website Settings). The other 4 want the marker in your HTML, or a point-and-click setting in their app. - Mouseflow's doc says
mf-maskedon its own acts likemf-excluded; addmf-listento keep the clicks. - Hotjar's
data-hj-allow, which un-hides a field, works only on input and textarea fields and does not pass down to children.
All 8 tools side by side
| Tool | Hide content, keep clicks | Leave the element out | Good to know | Source |
|---|---|---|---|---|
| UserProof | data-exclude (attribute) | Not offered: data-exclude keeps the click and replaces the element's text with [masked]. | Password fields are always masked with no marker. | public/sdk.js in the UserProof repository, read November 14, 2026 |
| Microsoft Clarity | data-clarity-mask="True" (attribute) | Not offered on the masking page: Clarity masks, it does not drop elements. | Unmask a child with data-clarity-unmask="true". | Clarity masking docs, read November 14, 2026 |
| Hotjar | data-hj-suppress (attribute) | data-hj-suppress (attribute) | Works as an attribute or a class. Inline SVGs can't be suppressed. | Hotjar help: How to Suppress Text, Images, Videos and User Input, read November 14, 2026 |
| FullStory | fs-mask (class) | fs-exclude (class) | fs-exclude also ignores clicks on the element. It replaces the old fs-block. | FullStory help: protecting your users' privacy, read November 14, 2026 |
| PostHog | maskTextSelector (setting) | ph-no-capture (class) | ph-no-capture swaps the element for a same-size block and also stops autocapture events from it. | PostHog session replay privacy docs, read November 14, 2026 |
| LogRocket | Not offered: LogRocket's doc says clicks on an element marked data-private are not directly detected. | data-private (attribute) | data-private keeps the element's size so playback lines up, and nothing else. | LogRocket DOM sanitization docs, read November 14, 2026 |
| OpenReplay | data-openreplay-obscured (attribute) | data-openreplay-hidden (attribute) | obscured does not cover svg or canvas; hidden covers svg but not canvas. | OpenReplay sanitize data docs, read November 14, 2026 |
| Mouseflow | mf-masked mf-listen (class) | mf-excluded (class) | mf-masked without mf-listen acts like mf-excluded. data-mf-replace="**REMOVED**" swaps in a placeholder. | Mouseflow help: Excluding, Masking, and Replacing Content via Code, read November 14, 2026 |
Worked example: a checkout card field and a chat box
A checkout page has a card number field (#card-number) and a support chat box built on a rich-text editor (.chat-editor). You want click counts on both, so you pick "Hide the content, keep the clicks".
- On Hotjar you add
data-hj-suppressto both elements in the template. - On PostHog you add
maskTextSelector: "#card-number, .chat-editor"toposthog.init. That covers the chat box's text; the card field is an input, which PostHog masks through its input settings instead. - On UserProof you add
data-exclude="#card-number, .chat-editor"to the script tag. The card field's value is never recorded anyway; the editor needs the marker, because a click on an unmarked rich-text editor stores up to the first 50 characters of its text.
What it can't do
- It does not check your page. Run the
querySelectorAllline under the result in your browser console to see how many elements your selector matches. - It does not cover network requests, console logs or URLs. Several of these tools record those too and have separate settings for them.
- "Keep the clicks" means the marker hides the content instead of dropping the element. The docs say outright what happens to clicks only for some tools (UserProof, FullStory, LogRocket, Mouseflow, PostHog's
ph-no-capture); for the others, mark a test element and check a recording. - It only knows what each vendor's doc said on November 14, 2026. Vendors rename markers; FullStory's
fs-blockbecamefs-exclude. - It does not touch your Content Security Policy. If a recorder stops loading after you add one, the CSP generator lists the hosts each session replay tool needs, and the CSP checker shows which of them your current policy blocks.
Where UserProof fits
UserProof records real visits with one script tag and hands your coding agent the one fix to make, with the file and line. Field values are never recorded, it sets no cookies (it keeps an anonymous visitor ID in localStorage and a session ID in sessionStorage, which EU consent rules can still cover) and data-exclude keeps any other area out. Free covers 3 sites and 5,000 recorded visits a month; see pricing, the help page on keeping areas out of recordings and whether session replay is GDPR compliant.
Sources
- UserProof: public/sdk.js in the UserProof repository (read November 14, 2026).
- Microsoft Clarity: Clarity masking docs (read November 14, 2026).
- Hotjar: Hotjar help: How to Suppress Text, Images, Videos and User Input and How to Show Elements and Keystrokes (data-hj-allow), both read November 14, 2026.
- FullStory: FullStory help: protecting your users' privacy (read November 14, 2026).
- PostHog: PostHog session replay privacy docs (read November 14, 2026).
- LogRocket: LogRocket DOM sanitization docs (read November 14, 2026).
- OpenReplay: OpenReplay sanitize data docs (read November 14, 2026).
- Mouseflow: Mouseflow help: Excluding, Masking, and Replacing Content via Code (page dated February 14, 2025, read November 14, 2026) and its Website Settings article (read November 14, 2026).
Cite this
UserProof, "Hide sensitive data in session replay: the masking snippet for 8 tools," https://getuserproof.com/hide-sensitive-data-in-session-replay; each vendor's masking rule read from its own docs on November 14, 2026.
FAQ
How do I hide sensitive data in session replay?
Mark the element in your HTML with the recorder's own attribute or class, or list its CSS selector where the tool accepts one. Each tool uses a different name: data-hj-suppress in Hotjar, data-clarity-mask="True" in Clarity, fs-mask or fs-exclude in FullStory, ph-no-capture in PostHog, data-private in LogRocket, data-openreplay-obscured in OpenReplay, mf-masked in Mouseflow and data-exclude in UserProof.
What is the difference between masking and excluding?
Masking hides what the element shows but keeps the element in the replay, often with its clicks. Excluding drops the element, and in FullStory, LogRocket and Mouseflow (without mf-listen) the clicks on it too. Mask a button you want click counts for; exclude a block nobody should see.
Are form fields masked by default?
It depends on the tool. UserProof never records field values and always masks password fields. PostHog's docs show input masking switched on with maskAllInputs, which you can turn off. Check your tool's privacy settings before relying on a default.
Can I add the attribute with JavaScript after the page loads?
Put it in the HTML where you can. A marker added after the recorder has taken its first snapshot may come too late for that first view. A selector setting (UserProof's script tag, PostHog's maskTextSelector, Clarity's dashboard) avoids that because the tool reads it at start.
Does this tool send my selector anywhere?
No. The snippets are built in your browser by the script on this page, which makes no network requests of its own. The form and the result are marked with data-exclude, so our own recorder on this site skips them.