JavaScript SDK - checkSanitization method
This method returns the sanitization level the tracker currently applies to a recorded node. It’s useful for debugging masking rules, for example after calling resanitize().
Signature
Section titled SignaturecheckSanitization(el: Node): SanitizeLevel | undefined
Parameters
Section titled Parametersel: Node: The DOM node to check.
Return value
Section titled Return valueReturns the node’s current level: 0 (Plain), 1 (Obscured) or 2 (Hidden), matching the SanitizeLevel enum exported by @openreplay/tracker. Returns undefined if the node isn’t tracked or the tracker isn’t initialized.
Example
Section titled Exampleimport { tracker, SanitizeLevel } from '@openreplay/tracker'
const level = tracker.checkSanitization(document.getElementById('account-details'))
if (level === SanitizeLevel.Plain) {
console.warn('account details are recorded in plain')
}