Redaction and Masking
Web RUM
The following options are available on the SDK to control the data that is captured. PII data may be captured in two places (a) as attributes of RUM events e.g. view.url_path
or action.name
(b) visual capture during session recording. Each of these data sources have separate ways to restrict what data is captured.
Some scenarios where PII could appear in RUM Events:
Action names on buttons
Names shown in URLs
Sensitive information being captured during session recording
RUM Action Names
RUM action names are derived from information in the DOM such as labels etc. If you need to control action names you can do the following:
Configure enablePrivacyForActionName
on RUM SDK:
kfuseRumSDK.init({
config: {
...
enablePrivacyForActionName: true,
},
});
With this setting the action names are defaulted to Masked Element
unless the element or a parent is specifically has a DOM attribute data-dd-action-name="My Custom Action Name"
.
Modify Event Attributes
All events can be modified before they leave the browser by attaching a beforeSend
hook. This hook function receives the RUM event object which you can modify as needed. e.g. If any of your URLs contain PII or ids in them you can use this method to sanitize those attributes.
To enable beforeSend
hook:
kfuseRumSDK.init({
config: {
...
beforeSend: function(event, context) {
// add code to modify the event
if (event.type == "view") {
// here removePIIFromURL is a custom function you
// introduce to perform the PII removal
event.view.url = removePIIFromURL(event.view.url)
}
// return true to send the modified event or false
// to drop the event itself
return true
},
},
});
For more details you may refer to the following.
Redaction in Session Replay
To control redaction and masking in session replay you will annotate your HTML with one of the RRWeb class names .rr-block
, .rr-ignore
and .rr-mask
(see details on the RRWeb guide). Note that the datadog SDK configuration attribute defaultPrivacyLevel
is ignored.