Skip to content

Privacy and masking

The privacy defaults of the SDKs, every option and attribute that masks more, how to keep whole areas of your app out, and how to see for yourself what is sent.

Applies to EngineCloud
View as Markdown
On this page
  1. The defaults you do not have to set
  2. Mask more
  3. One element: data-sypnia-mask
  4. One element, completely: data-sypnia-block
  5. Without touching the markup: maskSelector and blockSelector
  6. Every text: maskAllText
  7. Keep parts of the app out
  8. Asking for consent
  9. beforeSend
  10. What you send on purpose
  11. See what is sent
  12. What the agent sees
  13. Next

This page is for whoever is responsible for what leaves the app. It gives the names in code: options, attributes and functions. The rules behind them, in plain words, are in Masking and What is collected. Everything here happens inside the SDK, in the person’s browser or on your server, so it is the same for the open-source engine and for Sypnia Cloud.

At the end you will have: an app where you can state, and check, what Sypnia receives.

The defaults you do not have to set

DefaultCan it be turned off?
Everything a person types is masked, always. Text fields, text areas, dropdown choices and editable areas (contenteditable) are recorded as asterisks, one for each character.No. There is no option to record typed input.
Password, card and one-time-code fields are masked.No.
Hidden fields lose their value.No.
Events never carry a field’s value: a click on a field reports its label or placeholder.No.
url is the path only: no origin, no query, no hash. Routes replace ids by :id.No.
Request bodies, the answers of calls that succeeded, cookies and headers are never read. In the browser, from a failed API call the SDK keeps a code of at most 40 characters and a message of at most 160.The code and message: yes, with capture.requestFailureDetail: false.
On the server, a database call that answers with an error is read. The SDK keeps the database’s code and its full message as the database wrote it, values included, up to 2,000 characters: PostgREST’s code, and its message with its details and hint, or a pg error’s SQLSTATE, and its message with its detail and hint (duplicate key value violates unique constraint "users_email_key" then Detail: Key (email)=(maria@example.com) already exists.). That message can hold personal data the database put in it, such as an e-mail from the call that failed. On by default. See Database error details.Yes: captureDbErrors: false in the Node SDK’s init, or in withSypnia’s server. Then nothing is read and a pg error keeps only its SQLSTATE.
In the browser, e-mail addresses in error messages, error stacks and failure messages are replaced by [email].No.
On the server, the message of any other failed call is redacted: e-mail addresses, URLs, UUIDs, quoted values, long tokens and every run of digits. The Sypnia server SDKs and the bridge do it before the message leaves your server; for spans from any other OpenTelemetry exporter, ingest does it on arrival, to every failure message except a database message a Sypnia SDK sent as sypnia.db.message.No.
Sign-in parameters (access_token, refresh_token, token, code) are removed from links inside recordings.No.
Frames (iframe, frame, object, embed) and videos are left out of recordings, and nothing of their contents is recorded, even in a frame of your own origin. Canvas drawings are not recorded. Images are not copied.No.
No cookies. Two random ids in localStorage, which identify nobody. After identify(), the session entry also holds a hash of the person’s id, never the id, so a new sign-in starts a new session.See optOut below.

What is recorded as shown, unless you change it: the text your pages display, and with it the labels of what people click.

Mask more

One element: data-sypnia-mask

checkout.html
<section data-sypnia-mask>
  <h2>Shipping address</h2>
  <p>Ada Park, 12 Elm Street, Springfield</p>
</section>

Inside it, letters and digits become asterisks in recordings and page snapshots, now and when the content changes later. A click inside it is reported without a label. Use it for names, addresses, amounts, messages: any text that belongs to a person.

One element, completely: data-sypnia-block

account.html
<div data-sypnia-block>
  <img src="/documents/id-card.jpg" alt="Identity card" />
</div>

The element is not recorded. The recording shows an empty box of the same size. Use it for images, maps, charts, embedded widgets: anything whose shape alone says too much.

Without touching the markup: maskSelector and blockSelector

For elements you cannot put an attribute on, such as a third-party widget:

src/main.ts
init({
  project: 'spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e',
  maskSelector: '.customer-name, .order-total, [data-private]',
  blockSelector: '#support-chat, .map',
});

Every text: maskAllText

src/main.ts
init({
  project: 'spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e',
  maskAllText: true,
});

Recordings then show the layout, the clicks and the movement, with every word replaced. Events change too: clicks carry no label and no context, and form failures no field name. Problems become harder to read («a button was clicked five times» instead of «Pay was clicked five times»). Choose it for an app that is sensitive throughout: health, finance, anything about children.

A project can also turn this on for every browser at once, without a deploy, with the project setting replay.mask_all_text. Either one is enough: the SDK masks all text when the option or the setting says so.

Keep parts of the app out

You wantUseEffect
No recording on some routesreplay: { blockedRoutes: ['/account/cards'] } in init, or the project setting replay.blocked_routesNo replay and no page snapshot there. Recording stops on entering and resumes on leaving. Events are still sent, so problems are still found. The engine also refuses recordings of routes in the project’s list, so an old tab cannot send them.
No recording anywherereplay: false, snapshots: falseThe recorder is never loaded.
Nothing at all on some routesignoreRoutes: ['/admin']The SDK is inactive there: no events, no recording.
Only some routes, nothing anywhere elseallowRoutes: ['/dashboard', '/account'] in the browser’s init, in the Node SDK’s init or in withSypnia’s serverOutside those routes the SDK captures, records and traces nothing. ignoreRoutes still applies inside them.
Nothing at all for one personoptOut()Remembered in that browser until optIn().
To change or drop an event yourselfbeforeSendSee below.

A string in these lists covers the route and everything under it. Project settings are changed in the app on Sypnia Cloud, and through the API on any engine.

If your visitors must agree before analytics start, start the SDK switched off and switch it on when they agree:

src/main.ts
import { init } from '@sypnia/telemetry/browser';

init({
  project: 'spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e',
  enabled: localStorage.getItem('analytics-consent') === 'yes',
});

export function onConsent(agreed: boolean) {
  localStorage.setItem('analytics-consent', agreed ? 'yes' : 'no');
  if (agreed) location.reload();
}

With enabled: false the SDK stores nothing in the browser and sends nothing. The reload starts it for a visitor who has just agreed.

beforeSend

The last word on any event. It runs in the browser (or on your server, in the Node SDK) before the event is queued.

src/main.ts
init({
  project: 'spk_7d1f0c9e4b8a2f6d3c5e1a9b0f4d8c2e',
  beforeSend(event) {
    if (event.type === 'error' && event.msg.includes('order #')) {
      event.msg = event.msg.replace(/order #\w+/g, 'order #[id]');
    }
    if (event.type === 'custom' && event.name === 'internal_debug') return null;
    return event;
  },
});

It is not called for recording content, which is masked by the rules above and cannot be edited event by event.

What you send on purpose

The defaults cover what the SDK collects by itself. Three functions send what you give them, as you give it:

  • identify() sends the person’s id and, only if you pass them, a name and an e-mail. Send the id alone if you do not want personal data in Sypnia. See Identifying people.
  • track() sends the properties you choose. Never pass what a person typed.
  • reportError() sends the error’s message. Do not build error messages out of personal data.

See what is sent

  1. Set debug: true in init. The SDK prints every event to the console before it is queued, and says why when it sends nothing.
  2. Open the developer tools, tab Network, filter by ingest. Events go to …/v1/ingest/events, recordings to …/v1/ingest/replay, page snapshots to …/v1/ingest/snapshot. Bodies above 2,048 characters are gzipped.
  3. To check masking, type something into a form, cause an error (so the session is recorded), and watch the replay: what you typed is asterisks. A recording’s piece carries mask: 1 for the default rules and mask: 2 when all text is masked.

Every field of every event is listed in the event schema.

What the agent sees

The agent reads events: what was clicked, which requests failed, which error was thrown. It never reads recordings or typed input, and masked content never reaches Sypnia at all, so it cannot be sent to a model. See Models and what is sent.

Next

  1. The defaults you do not have to set
  2. Mask more
  3. One element: data-sypnia-mask
  4. One element, completely: data-sypnia-block
  5. Without touching the markup: maskSelector and blockSelector
  6. Every text: maskAllText
  7. Keep parts of the app out
  8. Asking for consent
  9. beforeSend
  10. What you send on purpose
  11. See what is sent
  12. What the agent sees
  13. Next

    Search pages, sections and terms