Quick answer
Data masking replaces sensitive values with altered ones, such as asterisks, a shortened form or a realistic fake, so data stays usable while the real value is hidden. It can be applied at capture, in a prepared copy or only when someone views the data, and each leaves something different stored.
What is data masking?
Data masking replaces sensitive values with altered ones, such as asterisks, a shortened form or a realistic fake, so the data stays usable while the real value is hidden. A phone number shown as xxxx, an email shown as RXXX@XXXX.com and a card field recorded as **** are all masked values.
It is not encryption, because encryption is meant to be reversed with a key and masking usually is not. It is also not automatically anonymisation: the Article 29 Working Party's Opinion 05/2014 (WP216) notes that techniques which only replace identifiers leave a person able to be singled out and linked across records. For the stronger idea, see anonymization.
Most pages that explain the term write about database masking: hiding production data in a test copy or from some database users. This page covers that briefly, then the case that matters in analytics: what a session recording, a report or an export is allowed to show. The central question is not how to mask but when: while the data is captured, or only when someone looks at it.
Three moments to mask
| When the mask is applied | What stays in storage | Who can still recover the original | Example |
|---|---|---|---|
| At capture (before the value is written) | Only the masked value | Nobody; the original was never stored | A recorder writes an input as asterisks; a string that looks like an email is replaced with a placeholder before it is saved |
| Static (a masked copy made ahead of time) | The masked copy; the source still holds the original | Whoever can read the source | A test database built from production with names and numbers replaced |
| Dynamic (masked in what a user sees) | The original, unchanged | Roles with unmask rights, administrators, and anyone who can infer values by querying | Microsoft SQL Server's dynamic data masking |
The last row is the one people mistake for protection of the data itself. Microsoft's documentation for dynamic data masking says plainly that the data in the database is not changed, that users with the UNMASK permission and administrative roles see the original, and that the feature does not stop a user who can run ad hoc queries from inferring values by guessing. It is an access control on what a result shows. That is useful; it is not the same as not holding the value.
The first row is the opposite. Open-source recorders expose it as an option set when recording: rrweb, whose player TapCub's console uses, can mask every input, masks password inputs by default and masks the text of elements you mark with a class name.
Common masking techniques
| Technique | What it does | Example | Reversible? |
|---|---|---|---|
| Full mask | Replaces the whole value with a fixed pattern | 555.123.4567 → xxxx | No |
| Partial mask | Keeps the first or last characters | A phone number reduced to its last four digits | No |
| Email mask | Keeps the first letter and a fixed shape | RTamburello@contoso.com → RXXX@XXXX.com | No |
| Substitution | Swaps in a realistic fake | Roberto → Maria | No, if the mapping is not kept |
| Shuffling | Moves real values between rows | Salaries reassigned across employees | No, if the order is not kept |
| Nulling | Deletes the value | NULL | No |
The examples for full masking and the email mask come from Microsoft's documentation. A partial mask is the one to be careful with: a first letter plus a domain can narrow a small customer list to a handful of people.
Worked example: where the mask goes decides what is stored
Sample data: a site has 20,000 sessions in a month and records 10% of them with session replay, so 2,000 recordings. The checkout form has 6 input fields. About 18% of sessions (360 of the 2,000 recordings) also open an account page that shows the person's name and email as plain text.
| Setup | Input values readable in storage | Recordings with name or email as text |
|---|---|---|
| No masking | 2,000 × 6 = 12,000 | 360 |
| Input values masked at capture | 0 | 360 |
| Input masked, plus the account page excluded from recording | 0 | 0 |
| Input not masked, but values hidden only when someone plays the recording | 12,000 | 360 |
The last row looks safe when you watch a recording and is not: the 12,000 values and the 360 pages are still stored for the retention period, in any export and in any backup. A mask that only works in the player protects the viewer from the data, not the data from a breach. Note also that masking inputs does nothing for text that is simply on the page, which is why the third row needs a different control: exclude the page, or mask all text.
When to mask at capture, at display or in a copy
- If you would rather not hold the value at all (passwords, card numbers, identity and medical forms), mask or exclude at capture. GDPR Article 5(1)(c) asks that data be limited to what is necessary, and Article 25(2) asks for that by default.
- If some roles need the value and others do not (support sees the email, a viewer does not), mask at display, and keep it combined with role limits and audit.
- If the data is going to a test or training environment, make a statically masked copy so the original never leaves production.
- If a value is only occasionally useful, shorten how long it is kept as well; masking and retention work together.
Common misunderstandings
- "Masked means anonymous." A masked field can sit next to a user ID, a device or a timestamp that still identifies the person. See PII.
- "If the player hides it, it is not there." Display masking changes what a screen shows. Stored data, exports and backups follow the stored value.
- "Mask all inputs and the recording is safe." Text printed on the page can still carry personal data.
- "Masking later fixes earlier recordings." A change in settings applies to what is captured next. Earlier recordings keep what they captured until they are deleted or expire.
- "One layer is enough." Capture, display and retention each cover a different failure.
Data masking in TapCub
TapCub has masking at capture (session replay and property stripping) and at display (roles). The two are separate layers, and this section is only about what an analytics user sees; live-chat conversations have their own retention and delete controls.
Start from the example above: you want recordings of the checkout flow without storing what people typed.
- Turn replay on deliberately. Session replay is off by default and only an owner or admin can enable it, in All-platform analytics › Behavior › Session replay › Settings. The switch asks you to confirm that your privacy policy covers recording and that pages with payment, ID or medical forms are on the exclude list.
- Keep the input mask on. Mask input values is on by default and records input values as asterisks. Mask all text is off by default; turn it on for back-office style pages where text on the page is personal. Password fields, blocks marked
data-tc-ignoreorwc-no-replay, and the support widget are never recorded. - Exclude paths. Excluded paths takes up to 20 path prefixes starting with
/; those pages are not recorded. This is the control for the account page in the example. - Shorten the exposure. The default sample rate is 10% (above 10% shows a storage warning), and retention is 30 days, adjustable from 1 to 90. An admin can delete recordings, and an owner can purge all of them. Changing settings does not rewrite recordings already made.
- Strip personal data from events. In Configuration › Privacy center, when stripping is on, strings that look like an email or a phone number in event properties are replaced with a placeholder before storage. Autocapture does not record visible text by default.
- Mask what members see. Separately, reports and exports apply display masking by role: none, partial or full. By default admins see identifiers in the clear, analysts see direct identifiers partly masked, and viewers see them fully masked. Direct identifiers are masked in lists and exports by default, and where a property rule and a member rule disagree, the stricter one wins. This does not change what is stored.
TapCub does not mask live-chat transcripts with these settings and does not replay support conversations; replay covers web pages only.
Sources
- Microsoft Learn, Dynamic Data Masking (SQL Server).
- rrweb, Guide: privacy and record options.
- Article 29 Data Protection Working Party, Opinion 05/2014 on Anonymisation Techniques (WP216).
- EUR-Lex, Regulation (EU) 2016/679 (GDPR): Article 5(1)(c) and Article 25(2).
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Engineer
Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.