Action Name Deobfuscation
Overview
When you enable the enablePrivacyForActionName initialization parameter, action names are masked for privacy. In minified builds, action names can also become unreadable because bundlers obfuscate the DOM element text and attributes that RUM uses to generate action names.
The Action Name Deobfuscation build plugin addresses both issues by instrumenting your source code at build time to generate a privacy dictionary that maps obfuscated values back to their original text. The RUM SDK uses this dictionary to resolve readable action names.
Prerequisites
- The RUM SDK initialized with
trackUserInteractions: true and enablePrivacyForActionName: true. See Mask all action names. - The Datadog build plugin installed and registered with your bundler. See Build Plugins for installation instructions.
Configuration
Configure the rum.privacy object in your build plugin options:
| Parameter | Type | Required | Default | Description |
|---|
rum.privacy.include | Array of RegExp or String | No | JS/TS files (.js, .ts, .jsx, .tsx, .mjs, .cjs, and variants) | File patterns to process for action name deobfuscation. |
rum.privacy.exclude | Array of RegExp or String | No | node_modules, .preval. files | File patterns to skip. |
Example
With default settings (processes all JS/TS files, excludes node_modules):
const { datadogWebpackPlugin } = require('@datadog/webpack-plugin');
module.exports = {
plugins: [
datadogWebpackPlugin({
rum: {
privacy: {},
},
}),
],
};
With custom include and exclude patterns:
const { datadogWebpackPlugin } = require('@datadog/webpack-plugin');
module.exports = {
plugins: [
datadogWebpackPlugin({
rum: {
privacy: {
include: [/\.jsx?$/, /\.tsx?$/],
exclude: [/\/node_modules\//, /\/test\//],
},
},
}),
],
};
These examples use webpack. The configuration object is identical across all supported bundlers. See
Build Plugins for installation instructions.
Further reading
Additional helpful documentation, links, and articles: