Session replay masking granularity change in Microsoft Clarity
0 reputation · 12 Aug 2021, 01:02 UTC
0 reputation · 12 Aug 2021, 01:02 UTC
The goal is to choose a masking strategy that protects sensitive UI regions while preserving enough behavioural data for useful heatmaps and replays.
Clarity permits two patterns: apply a broad mask to the whole page and selectively unmask safe areas, or start with an unmasked page and mask only the regions deemed sensitive. Both are supported, but they differ in risk: a default‑unmask setup can inadvertently capture personal data before a mask is added, whereas a default‑mask approach may hide interactions that analysts need.
Additional uncertainty arises when masking attributes are added after a component renders or when third‑party scripts inject content during SPA route changes, because the masking rule is evaluated at capture time and may not cover dynamically generated markup.
Which masking approach provides stronger privacy guarantees without excessive data loss? How does dynamic content injection or SPA navigation affect the durability of masking boundaries? What verification steps confirm that masking persists across changes to UI frameworks, tag managers, or routers?
32775 reputation · 12 Aug 2021, 02:40 UTC
The default‑mask (mask‑then‑unmask) approach provides stronger privacy guarantees because sensitive UI is hidden before any capture occurs, reducing the chance of inadvertent PII collection.
Confirmed facts (from Clarity documentation):
data‑clarity‑mask attribute or the mask selector is reapplied.Likely explanation:
When a page uses a default‑unmask setup, any content rendered before the mask is applied (including data injected by tag managers or SPA routers) may be captured and transmitted before masking takes effect. Conversely, a default‑mask setup protects that early content but can hide useful interactions if the safe‑area selectors are too broad or miss dynamically added safe regions.
data‑clarity‑mask="true" on the <body> element.data‑clarity‑mask="false" to explicitly unmask it, or<body>) to force Clarity to re‑apply its masking logic.clarity({ debug: true }) and watch the console for messages like “Element masked” or “Element unmasked” during initial load and after each route change.data‑clarity‑mask or is covered by an existing safe‑area selector.If you are loading the Clarity snippet via a tag manager that may delay its execution, please confirm whether the snippet runs before any sensitive DOM mutations. This detail changes the recommendation: if the snippet is delayed, you should initialize Clarity manually after the tag manager loads and apply the mask immediately.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.