Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RUM] document actionNameAttribute usage #11014

Merged
merged 3 commits into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ further_reading:
---


Real User Monitoring (RUM) Browser SDK automatically detects user interactions performed during a user journey.
Real User Monitoring (RUM) Browser SDK automatically detects user interactions performed during a user journey.

The automatic collection of user actions provides insights into user behavior, without having to manually instrument every single click in your application. It helps you achieve the following objectives:
* Understand the performance of key interactions (for example, a click on the "Add to cart" button)
Expand Down Expand Up @@ -75,6 +75,24 @@ The RUM library uses various strategies to get a name for click actions. If you
Enter a valid email address
</div>
```

Starting with [version 2.16.0][3], with the `actionNameAttribute` initialization parameter, you can specify your own attribute that is used to name the action. For example:

```html
<script>
DD_RUM.init({
...
trackInteractions: true,
actionNameAttribute: 'data-custom-name',
...
})
</script>

<a class="btn btn-default" href="#" role="button" data-custom-name="Login button">Try it out!</a>
```

**Note**: `data-dd-action-name` is favored when both attributes are present on an element.

## Custom actions

Custom actions are user actions declared and sent manually by using the `addAction` API. They are used to send information relative to an event occurring during a user journey. In the following example, the RUM SDK collects a visitor's cart data when they hit the checkout button. The number of items within the cart, the list of items, and how much the cart is worth overall are collected.
Expand Down Expand Up @@ -145,3 +163,4 @@ window.DD_RUM &&

[1]: /real_user_monitoring/browser/modifying_data_and_context/
[2]: /real_user_monitoring/browser/data_collected/#default-attributes
[3]: https://github.com/DataDog/browser-sdk/blob/main/CHANGELOG.md#v2160