Skip to content

Commit 4bd4520

Browse files
authored
[DOCS-12638] Add enablePrivacyForActionName flag info (#33290)
1 parent 62b9d9d commit 4bd4520

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

content/en/real_user_monitoring/application_monitoring/browser/tracking_user_actions.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ The `trackUserInteractions` initialization parameter enables the collection of u
3838

3939
To control which information is sent to Datadog, you can [mask action names with privacy options][2], [manually set an action name](#declare-a-name-for-click-actions), or [implement a global scrubbing rule in the Datadog Browser SDK for RUM][3].
4040

41+
### Mask all action names
42+
43+
To mask all action names by default, use the `enablePrivacyForActionName` initialization parameter:
44+
45+
```javascript
46+
window.DD_RUM.init({
47+
...
48+
trackUserInteractions: true,
49+
enablePrivacyForActionName: true,
50+
});
51+
```
52+
53+
When enabled, all action names are replaced with `Masked Element`. Action names explicitly set with the `data-dd-action-name` attribute are still displayed, allowing you to selectively expose specific action names while keeping others masked.
54+
4155
## Track user interactions
4256

4357
The RUM Browser SDK automatically tracks clicks to generate click actions. A one-click action generally represents one user click, except when the same element is clicked multiple times in a row, which is considered a single action (see [Frustration Signals "rage clicks"][4]).
@@ -103,11 +117,13 @@ For example:
103117

104118
### How action names are computed
105119

106-
The Datadog Browser SDK uses different strategies to compute click action names:
120+
The Datadog Browser SDK uses the following strategies to compute click action names:
107121

108122
1. If the `data-dd-action-name` attribute or a custom attribute (as explained above) is explicitly set by the user on the clicked element (or one of its parents), its value is used as the action name.
109123

110-
2. If `data-dd-action-name` attribute or its equivalent is not set, depending on the element type, the sdk uses other attributes such as `label`, `placeholder`, `aria-label` from the element or its parents to construct the action name. If none of these attributes is found, the sdk uses the inner text as name for the action.
124+
2. If no explicit action name attribute is set and `enablePrivacyForActionName` is enabled, the action name is set to `Masked Element`.
125+
126+
3. Otherwise, depending on the element type, the SDK uses other attributes such as `label`, `placeholder`, or `aria-label` from the element or its parents to construct the action name. If none of these attributes is found, the SDK uses the inner text as the action name.
111127

112128
## Send custom actions
113129

0 commit comments

Comments
 (0)