---
title: Compute Apdex And Custom Performance Indicators With RUM Data
description: >-
  Guide for computing your Apdex score and custom performance indicators with
  RUM data
breadcrumbs: >-
  Docs > RUM & Session Replay > Real User Monitoring & Session Replay Guides >
  Compute Apdex And Custom Performance Indicators With RUM Data
---

# Compute Apdex And Custom Performance Indicators With RUM Data

## Overview{% #overview %}

Datadog collects Real User Monitoring (RUM) events from browser and mobile RUM SDKs that you can use to build a quick graph and compute performance indicator metrics such as Apdex.

To compute your Apdex score, you can use service monitoring from APM or user monitoring data from the RUM SDKs. This guide provides instructions on computing Apdex for an application with RUM data and the **Query Value** widget in a [Quick Graph](https://docs.datadoghq.com/dashboards/guide/quick-graphs.md).

For more information about computing Apdex with service monitoring data, see [Configure Apdex score by service](https://docs.datadoghq.com/tracing/guide/configure_an_apdex_for_your_traces_with_datadog_apm.md).

## Prerequisites{% #prerequisites %}

- Your web or mobile application is instrumented with the RUM SDK. To set up instrumentation, see [RUM Browser Monitoring](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser.md), [RUM Android Monitoring](https://docs.datadoghq.com/real_user_monitoring/android.md), and [RUM iOS Monitoring](https://docs.datadoghq.com/real_user_monitoring/ios.md).
- Events from your application are available in Datadog.

## Compute an Apdex score{% #compute-an-apdex-score %}

The example below calculates an Apdex score using the Largest Contentful Paint performance metric from RUM events, and a hypothetical threshold of `T = 2 sec`. The minimum frustrating latency is `4T = 8 sec`. The resulting value is shown in a Query Value widget quick graph that you can export to dashboards or notebooks.

### Create a quick graph{% #create-a-quick-graph %}

1. Navigate to **Dashboards** > **Quick Graph**.
1. Create three RUM queries:
   - Query `a` for all satisfying page loads (RUM views where Largest Contentful Paint takes less than 2 seconds to load).
   - Query `b` for all tolerated page loads (RUM views where Largest Contentful Paint takes less than 8 seconds to load).
   - Query `c` for all page loads (all RUM views).
1. In the **Formula** field, enter the Apdex formula `(a + 0.5 * b) / c`.
1. Under **Select a visualization**, click **Query Value**. A query value widget appears.
1. In the time frame selector, select **Past 1 Day**. By default, the widget displays in Global Time.
1. Enter a name for your graph, such as `Apdex Score`.
1. Optionally, export or copy and paste the quick graph to a dashboard or notebook, or click **Export** > **New Dashboard** to create a dashboard with this quick graph.

#### Query A{% #query-a %}

1. In **Graph your data**, select `RUM` as the data source for query `a` and enter `@view.largest_contentful_paint:<2s`.
1. Press Enter or click **Update query** in the dropdown menu. The `Largest Contentful Paint:<2s` query appears next to `RUM` for query `a`.

#### Query B{% #query-b %}

1. To create query `b`, click **+ Add Query**.
1. Select `RUM` as the data source for query `b` and enter `@view.largest_contentful_paint:[2s TO 8s]`.
1. Press Enter or click **Update query** in the dropdown menu. The `Largest Contentful Paint:[2s - 8s]` query appears next to `RUM` for query `b`.

#### Query C{% #query-c %}

1. To create query `c`, click **+ Add Query**.
1. Select `RUM` as the data source for query `c` and enter `@Type:view`.
1. Press Enter or click **Update query** in the dropdown menu. The `Type:view` query appears next to `RUM` for query `c`.

{% image
   source="https://docs.dd-static.net/images/real_user_monitoring/guide/quick-graph.cc9f9ac3ce45f17db82fadfe9003d2cb.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/real_user_monitoring/guide/quick-graph.cc9f9ac3ce45f17db82fadfe9003d2cb.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Apdex score in a quick graph" /%}

### JSON configuration{% #json-configuration %}

To access the JSON code for this graph, click the **JSON** tab next to **Edit**.

Click the copy icon on the right hand corner to copy the quick graph JSON to your clipboard.

In the `JSON` file:

```json
{
    "viz": "query_value",
    "requests": [
        {
            "formulas": [
                {
                    "formula": "(query1 + 0.5 * query2) / query3"
                }
            ],
            "queries": [
                {
                    "search": {
                        "query": "@type:view @view.largest_contentful_paint:<2000000000"
                    },
                    "data_source": "rum",
                    "compute": {
                        "aggregation": "count"
                    },
                    "name": "query1",
                    "indexes": [
                        "*"
                    ],
                    "group_by": []
                },
                {
                    "search": {
                        "query": "@type:view @view.largest_contentful_paint:[2000000000 TO 8000000000]"
                    },
                    "data_source": "rum",
                    "compute": {
                        "aggregation": "count"
                    },
                    "name": "query2",
                    "indexes": [
                        "*"
                    ],
                    "group_by": []
                },
                {
                    "search": {
                        "query": "@type:view"
                    },
                    "data_source": "rum",
                    "compute": {
                        "aggregation": "count"
                    },
                    "name": "query3",
                    "indexes": [
                        "*"
                    ],
                    "group_by": []
                }
            ],
            "response_format": "scalar",
            "conditional_formats": []
        }
    ],
    "autoscale": true,
    "precision": 2
}
```

## Additional visualizations and Apdex scores{% #additional-visualizations-and-apdex-scores %}

In the example above, the Apdex score is relevant to the View RUM events and Largest Contentful Paint performance metric.

You can also calculate other Apdex scores with the following methods:

- To see the Apdex score trend over time, select `Timeseries` instead of `Query Value` in **Select your visualization**.
- To compute the Apdex score for a specific application, add an additional `@application.name` query and update your formula.
- To compute the Apdex score with another RUM performance metric such as First Contentful Paint, replace `@view.LargestContentfulPaint` with `@view.FirstContentfulPaint` in the queries.

To compute additional performance indicators for your applications, determine what datapoints you need and which RUM events are relevant for you before creating a quick graph.

## Further Reading{% #further-reading %}

- [Configure Apdex score by service](https://docs.datadoghq.com/tracing/guide/configure_an_apdex_for_your_traces_with_datadog_apm.md)
- [RUM Dashboards](https://docs.datadoghq.com/real_user_monitoring/explorer.md)
- [RUM Browser Data Collected](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/data_collected.md)
- [RUM Android Data Collected](https://docs.datadoghq.com/real_user_monitoring/android/data_collected.md)
- [RUM iOS Data Collected](https://docs.datadoghq.com/real_user_monitoring/ios/data_collected.md)
