- Mark regions Moss must never read with
data-moss-redact. - Leave
redactAllInputson (the default), so the values of native form fields (input,textarea,selectand editable regions) stay out of page text, recordings and screen history. Custom controls built from other elements, such as a dropdown made ofdivs, are read as ordinary page text: mark them withdata-moss-redact. - Decide whether to turn on vision screenshots and session recording. Both send more than page text, and redaction does not cover vision screenshots.
At a glance
To stop collection altogether until your own policy allows it, see Turning collection on and off.
From 0.17.0, the dashboard’s Configure > Data & privacy page summarizes what an application collects. How long Moss keeps each kind of data is set there too; see Data & privacy.
Page text
With each question and each guide step, the SDK serializes the page into text for the model. It reads the element thatobserveTargetSelector matches ('body' by default) and everything inside it, including content below the fold and inside scrollable areas.
What the text contains:
- Each visible element’s tag and a fixed set of attributes, including
id,class,role,name,value,placeholder,href,title,alt,src,type,for, commonaria-*attributes, form attributes such aschecked,disabled,required,minandmax,data-testidanddata-id. - For a
selectthat isn’t redacted, its selected option and its first few options. - Text. For a button, link or other interactive element, all the text inside it. For any other element, only its own text, not its children’s. Text is cut at 100 characters per element.
- The text an element’s
aria-describedbypoints to, up to 200 characters, even when that text is hidden (for example a tooltip shown on hover). - Content inside open shadow roots and same-origin iframes.
- A short summary at the top: counts of links, buttons and form fields, and any visible alerts, invalid fields and empty required fields.
- Elements hidden with
display: none,visibility: hiddenoropacity: 0, elements inside aninertsubtree, and elements the user can’t scroll to. <script>,<style>,<head>,<meta>,<link>and<noscript>.- Closed shadow roots, and cross-origin or sandboxed iframes, which the browser does not let the SDK read.
- Moss’s own interface.
- After 10 consecutive siblings of the same tag, the rest are summarized as a count.
How much page context to send: pageContext
- The URL is the page’s full address (
window.location.href), query string and fragment included. - With
'metadata'or'none', Moss doesn’t see the page’s elements, so it can’t guide the user through them. pageContextdoes not turn off session recording or screen history. They have their own switches.- npm package: the value in your config applies,
'full'when unset. - CDN script: the application’s setting applies unless
window.mossSettings.pageContextsets one. With On-screen guidance turned off under Configure > Behavior > Core Features, the application normally collects at'metadata'.
Limiting the area Moss reads: observeTargetSelector
Set observeTargetSelector to a CSS selector, and Moss reads page text only from the first element that matches it and its contents. The default is 'body'. If no element matches, the SDK logs Could not find target element and has no page to read.
It limits page text only (and part of the stability wait). Vision screenshots, session recordings and screen history still cover the whole page; use data-recording-block or redaction for recordings and screen history.
Redaction
Redaction hides parts of the page from what Moss reads. There are four markers, and each covers different outputs.data-moss-redact
Put data-moss-redact on any element. The element and everything inside it, at any depth, are redacted, including content in its shadow roots and in same-origin iframes inside it.
- its text becomes
[REDACTED]; - these attribute values become
[REDACTED]:value,placeholder,title,alt,aria-label,aria-labelledby,aria-describedby,name,data-testid,data-id,href,srcandid; - an
iframeinside it is not read at all.
data-moss-redact region.
Form fields: redactAllInputs and data-moss-unredact
redactAllInputs is true by default. The values of every input, textarea, select and editable (contenteditable) element are redacted the same way, as is anything inside an editable region.
Only those native fields count. A custom control that shows its value as ordinary text, such as a dropdown, combobox or date picker built from divs, is not a form field to Moss: its text is read like any other text. Mark such controls with data-moss-redact.
What input redaction keeps out, with redactAllInputs on:
To let Moss read one field, for example a search box, mark it, or a container around it, with
data-moss-unredact:
data-moss-unredact only lifts input redaction. It does not override data-moss-redact or redactionSelectors, and it has no effect on session recordings.
To turn input redaction off entirely, set redactAllInputs: false.
Your own selectors: redactionSelectors
If your app already marks sensitive elements for another tool, such as FullStory’s .fs-exclude, list those selectors instead of adding data-moss-redact everywhere:
data-moss-redact elements are. Two differences: Moss can still highlight controls inside them, and it reads their shadow roots, redacted.
data-moss-redactalways applies, whatever this list holds.- An invalid selector is skipped for page text. For session recording and screen history, it stops that session from being recorded, with an error in the console.
data-recording-block
data-recording-block keeps an element out of session recordings and screen history only. It does not affect page text.
What each marker covers
“Blocked” means the replay shows the element as a blank box of the same size. Before 0.17.0, recordings blocked only
data-recording-block (and the rr-block class below) and did not mask form fields other than password fields.
Moss reads
redactionSelectors and redactAllInputs for the page text once, when AgentProvider mounts. Set them in the config you mount with.Programmatic changes: pageSanitizationScript
pageSanitizationScript is not a redaction tool. It runs on your live page, when the SDK starts watching it and again whenever the function’s identity or observeTargetSelector changes, so it changes what the user sees too. See Advanced > Programmatic page changes.
Vision screenshots
Moss sends a screenshot of what the user shares, normally this tab, with a question or guide step only when all three hold:- Vision is on, through the application’s Enable Vision switch under Configure > Behavior > Core Features, or through
useVision: truein your config. pageContextis'full'(the default).- The user allows the browser’s screen-capture prompt.
useVisionin your config overrides the application’s setting in both directions.useVision: truetakes screenshots even when Enable Vision is off, anduseVision: falsestops them even when it is on.- Leave
useVisionunset and the application’s setting applies, delivered with each session. Enable Vision is off by default for a new application. - On the CDN script, set the same option as
window.mossSettings.useVision.
- On the first question, Moss asks the browser for screen sharing, stating a preference for a browser tab and for the current tab. The browser’s prompt still lets the user pick another tab, a window or the whole screen.
- Moss checks only that what was shared is about the size of this tab’s viewport (within about 100 pixels in width and 200 in height). If it isn’t, Moss asks again; after two wrong choices it stops asking.
- Another tab of about the same size, or the whole browser window, passes that check. Moss then sends frames of what the user shared: another tab, or the whole window, including its tab strip and address bar.
- Once sharing is accepted, that question and each later one, and each guide step, sends a frame: a JPEG up to 1,920 pixels wide, uploaded to your Moss deployment’s storage through a signed upload URL, or sent inline with the request if that upload fails.
- If the user cancels, Moss sends no screenshots and doesn’t ask again until the page reloads. When the user stops sharing, screenshots stop.
screenshotMode ('fullpage' or 'viewport') has no effect on these screenshots in 0.17.0.
Session recording
Session recording captures the page for replay in the dashboard (Session Replay). It is off unless you turn it on.Changed in 0.17.0. Moss now records only for an application that has saved Enable Session Replay on, and the server refuses recordings otherwise, so an npm app that sets
enableSessionRecording: true needs the switch on as well. In 0.16.x, the CDN script recorded for an application that had never saved the switch, and the server accepted a recording from any SDK that sent one. On the npm package, enableSessionRecording was already off unless you set it.- The application allows it. Enable Session Replay is on under Configure > Behavior > Core Features. From 0.17.0, the server refuses recordings for an application where it is off.
- The SDK records.
- npm package: set
enableSessionRecording: true. - CDN script: the application’s setting applies, unless
window.mossSettings.enableSessionRecordingis set.
- npm package: set
- The chat is open and a session exists. Recording starts when the chat opens. It stops, and the rest is uploaded, when the chat closes or after 15 minutes without mouse, keyboard, scroll or touch activity.
rr-block (the element becomes a blank box), rr-mask (its text is masked) and rr-ignore (its input events are not recorded).
Screen history
Screen history gives the model a short timeline of what the user did on the page since the previous question or guide step: clicks, form input, scrolling, navigation and significant page changes, with the current path. It is off by default.- npm package: set
enableScreenHistoryRecording: true. - CDN script: the application’s Enable Screen History for AI setting under Configure > Behavior > Core Features applies, unless
window.mossSettingssets it.
Guide step reports
When the user completes a guide step, for example by clicking the highlighted button, the SDK reports the element they acted on: its text, label and markup. Redacted parts are replaced as in the page text. If the element itself is redacted, none of it is sent. Withstability.afterReload on, the SDK also writes this report to localStorage as the user clicks, so that if the click loads another page, that page can send it. The record is valid for pendingTTL (30 seconds by default).
User metadata
userMetadata describes the user to Moss, for example their role or plan:
- It is sent when a session starts and kept with the session.
- Moss gives it to the model as data, to word its answers. Values from your config are self-reported: they unlock nothing.
- Limits: up to 20 keys; keys up to 100 characters; values are strings up to 200 characters, numbers, booleans, or arrays of strings up to 500 characters in all.
- A key that also appears in your token’s
metadataclaim takes the token’s value. See Authentication. - Only a
rolesigned into the token can open procedures restricted to certain roles. Arolethat only your config supplies does not. - Use roles and categories, not names, email addresses or phone numbers.
Messages and files
What the user types is sent as written. Redaction does not apply to chat messages. From 0.17.0, Backend PII filtering under Configure > Security replaces common personal-data patterns (email addresses, US phone numbers, payment card numbers, US Social Security numbers, and patterns you add) with[REDACTED] before Moss stores a request or sends it to the model. It is off unless the application or the deployment turns it on. It applies to text: page text, the screen history timeline, the page title, guide step reports and, if you choose, chat messages. It does not change screenshots or recordings.
From 0.17.0, files a user attaches (a beta feature, off by default) are uploaded to your Moss deployment’s storage. See Appearance.
Turning collection on and off
From 0.17.0, two options let your own policy decide whether Moss runs at all.collectionEnabled
Set collectionEnabled: false and Moss does not start.
- npm package:
AgentProviderrenders nothing, including its children. Keep your own UI outside the provider. - CDN script: set
window.mossSettings = { collectionEnabled: false }before the script loads, and the script doesn’t boot: it sends no request until you callwindow.MossSDK.boot({ collectionEnabled: true }). As it loads, it still writes one value tolocalStorage: the widget’s interface language, undermossLng. Importing the npm package writes the same key.
collectionControl
MossCollectionControl is a switch your code holds. Moss mounts only while it is enabled.
- The control starts disabled. Call
enable()to mount Moss, anddisable()to unmount it. disable()cancels Moss’s requests in flight and discards an unsent recording without a final upload.- Each time Moss mounts or unmounts under a control, it clears its own browser state, so no chat resumes across mounts. It never clears your storage.
- The control’s
applicationIdanduserIdmust match the provider’s config, or the provider throws an error. All three identity fields are required. - For a different user or company, disable the old control, then create a new control and a new config with its own token function.
- A control decides only whether the browser collects. It authorizes nothing on the server; your tokens still do.
- While the control is disabled, the provider renders none of its children.
What the SDK does not read
- Your cookies and storage. The SDK keeps its own state under keys that start with
moss; see What is stored in the browser. The one exception is language detection: to pick its interface language, it checks thelngquery parameter, ani18nextcookie and ani18nextLngsessionStorageentry. - Content the browser keeps from it: closed shadow roots and cross-origin iframes.
- Pages where it isn’t mounted.
Common questions
Doesdata-moss-redact hide content from screenshots?
No. A vision screenshot is the raw frame of what the user shared. Turn vision off (useVision: false) on those pages, or lower pageContext to 'metadata' or 'none'. Redaction does cover page text, guide step reports, and, from 0.17.0, session recordings and screen history.
Why are no sessions recorded?
Check all three conditions in Session recording: Enable Session Replay on for the application, enableSessionRecording: true in an npm integration, and an open chat. From 0.17.0, an application that never saved the setting does not record.
Can I keep Moss from reading a page at all?
Use pageContext: 'none' and leave vision, session recording and screen history off; Moss then has only the conversation and your userMetadata. To keep Moss off a page entirely, don’t mount it there, or set collectionEnabled: false.
Does Moss read password fields?
Not in page text, guide step reports, recordings or screen history while redactAllInputs is on, the default. A vision screenshot shows the page as the user sees it. With redactAllInputs: false, recordings and screen history still mask type="password" fields, but page text and guide step reports don’t; mark password fields with data-moss-redact.
Who receives this data?
The SDK sends it only to the apiUrl you configure, and uploads screenshots and attachments to the storage your Moss deployment names. What the backend then sends to a model provider depends on how Moss is deployed; see Data protection.