RUM Get started
Security Monitoring is now available Security Monitoring is now available

RUM Get started

To set up Datadog Real User Monitoring solution:

  1. On the Real User Monitoring page, click the New Application button.
  2. Fill out Application Details, and click Generate Client Token. This automatically creates a clientToken and an applicationId for your application.
  3. Setup the Datadog RUM SDK through npm or paste the generated code snippet into the head tag.
  4. Deploy the changes to your application. Once your deployment is live, Datadog starts collecting events from your user’s browsers.
  5. Visualize the data collected in Datadog out of the box Dashboards.

Note: Your application shows up on the application list page as “pending” until Datadog starts receiving data.

npm Setup

After adding @datadog/browser-rum to your package.json file, initialize it with:

import { datadogRum } from '@datadog/browser-rum';

datadogRum.init({
    applicationId: '<DATADOG_APPLICATION_ID>',
    clientToken: '<DATADOG_CLIENT_TOKEN>',
    datacenter: 'us',
    sampleRate: 100,
});
import { datadogRum } from '@datadog/browser-rum';

datadogRum.init({
    applicationId: '<DATADOG_APPLICATION_ID>',
    clientToken: '<DATADOG_CLIENT_TOKEN>',
    datacenter: 'eu',
    sampleRate: 100,
});

Bundle Setup

Paste the generated code snippet into the head tag (in front of any other script tags) of every HTML page you want to monitor in your application. Including the script tag higher and synchronized ensures Datadog RUM can collect all performance data and errors.

<script
    src="https://www.datadoghq-browser-agent.com/datadog-rum-us.js"
    type="text/javascript"
></script>
<script>
    window.DD_RUM &&
        window.DD_RUM.init({
            clientToken: '<CLIENT_TOKEN>',
            applicationId: '<APPLICATION_ID>',
            sampleRate: 100,
        });
</script>
<script
    src="https://www.datadoghq-browser-agent.com/datadog-rum-eu.js"
    type="text/javascript"
></script>
<script>
    window.DD_RUM &&
        window.DD_RUM.init({
            clientToken: '<CLIENT_TOKEN>',
            applicationId: '<APPLICATION_ID>',
            sampleRate: 100,
        });
</script>

Note: The window.DD_RUM check is used to prevent issues if a loading failure occurs with the RUM SDK.

Initialization parameters

ParameterTypeRequiredDefaultDescription
applicationIdStringYes``The RUM application ID.
clientTokenStringYes``A Datadog Client Token.
datacenterStringYesusThe Datadog Site of your organization. us for Datadog US site, eu for Datadog EU site.
resourceSampleRateNumberNo100Percentage of tracked sessions with resources collection. 100 for all, 0 for none of them.
sampleRateNumberNo100Percentage of sessions to track. Only tracked sessions send rum events. 100 for all, 0 for none of them.
silentMultipleInitBooleanNofalseInitialization fails silently if Datadog’s RUM is already initialized on the page
proxyHostStringNo``Optional proxy URL. See the full proxy setup guide for more information.

Further Reading