Send RUM Custom Actions

Send RUM Custom Actions


Real User Monitoring automatically collects actions on your web application. You may also want to collect additional events and timings such as form completions and business transactions. With custom RUM actions, monitor any interesting event with all the relevant context attached. As an example throughout this guide, user checkouts information from an e-commerce website is collected.

Instrument your code

To create a new RUM action, use the addAction API. Give your action a name and then attach context attributes in the form of a JavaScript object. In the following example, a checkout action is created with details about the user cart when the user clicks on the checkout button.

function onCheckoutButtonClick(cart) {
    DD_RUM.addAction('checkout', {
        'value': cart.value, // for example, 42.12
        'items': cart.items, // efor example, ['tomato', 'strawberries']

All RUM context is automatically attached (such as current page view information, geoIP data, or browser information) along with extra attributes provided with the Global Context API.

Create facets and measures on your new attributes

After you have deployed the code that creates your custom actions, actions appear in the RUM Explorer, in the Actions tab.

To filter on your new custom Actions, use the Action Target Name attribute as follow:<ACTION_NAME>. The example uses the following filter:

Once you click on the action, all metadata is available in the side panel. You can find your action attributes in the Custom Attributes sections. The next step is to create facets or measures for these attributes by clicking on them. For example, create a facet for the cart items and a measure for the cart value.

Note: Use facets for distinctive values (IDs) and measures for quantitative values (timings, latency, etc.).

Use your attributes in the explorer, dashboards, and monitors

Now that facets and measures have been created, you can use your action attributes in RUM queries. This means you can build dashboards widgets, monitors and advanced queries in RUM Explorer/Analytics.

As an example, the following screenshot shows the average cart value per country for the last day. Using the dropdown menu on the top right corner, you can export this query as a dashboard widget or as a monitor.

Further Reading

Additional helpful documentation, links, and articles: