Skip to content

Track User Actions

Overview

Browser monitoring automatically detects user interactions and provides insights into user behavior without requiring you to manually instrument every click in your application.

You can achieve the following goals:

  • Understand the performance of key interactions (e.g., clicking an action button)
  • Quantify feature adoption
  • Determine the steps leading to a browser error

Control Whether to Enable Action Collection

The trackUserInteractions initialization parameter can collect user clicks in your application, which means that sensitive and private data contained in the page may be included to identify the elements with which the user interacts.

Track User Interactions

The RUM SDK automatically tracks clicks. A click action is created if all of the following conditions are met:

  • Activity is detected after the click. Page Activity Status
  • The click does not result in loading a new page, in which case the RUM SDK generates another RUM View event.
  • The Action name can be retrieved

Action Metrics

Metric Type Description
action.duration number(ns) The load time of the action.
action.action_long_task_count number The count of all long tasks collected for this action.
action.action_resource_count number The count of all resources collected for this action.
action.action_error_count number The count of all errors collected for this action.

The RUM SDK calculates the action load time by listening for page activity after each click. When the page no longer has activity, the action is considered complete.

Action Attributes

Attribute Type Description
action.action_id String The UUID of the user action.
action.action_type String The type of user action. For custom user actions, it is set to "custom".
action.action_target String The element with which the user interacted. Only applicable to automatically collected actions.
action.action_name String A user-friendly name is created (e.g., "Click on #checkout"). For custom user actions, the action name given in the API call.

Action Names

The RUM SDK uses various strategies to retrieve the name of a click action. If you want more control, you can define the data-guance-action-name attribute on the clickable element (or any of its parent elements).

For example:

<a class="btn btn-default" href="#" role="button" data-guance-action-name="Test Button">Click Me!</a>

Using the actionNameAttribute initialization parameter, you can add a custom attribute to the element to specify the action name.

For example:

   window.DATAFLUX_RUM.init({
     ...
     trackUserInteractions: true,
     actionNameAttribute: 'data-custom-name',
   ...
   })

<a class="btn btn-default" href="#" role="button" data-custom-name="Click Button">Click Me!</a>

When both attributes are present on the element, data-guance-action-name takes precedence.

Custom Actions

To extend user Action data, use the addAction API to create custom Actions. Details Reference