RUM Browser Data Collected
Incident Management is now generally available! Incident Management is now generally available!

RUM Browser Data Collected

The Datadog Real User Monitoring SDK generates six types of events:

Event TypeRetentionDescription
Session30 daysA user session begins when a user starts browsing the web application. It contains high-level information about the user (browser, device, geolocation). It aggregates all RUM events collected during the user journey with a unique session.id attribute.
View30 daysA view event is generated each time a user visits a page of the web application. While the user remains on the same page, resource, long-task, error and action events are linked to the related RUM view with the view.id attribute.
Resource15 daysA resource event is generated for images, XHR, Fetch, CSS, or JS libraries loaded on a webpage. It includes detailed loading timing information.
Long Task15 daysA long task event is generated for any task in the browser that blocks the main thread for more than 50ms.
Error30 daysRUM collects every frontend error emitted by the browser.
Action30 daysRUM action events track user interactions during a user journey and can also be manually sent to monitor custom user actions.

The following diagram illustrates the RUM event hierarchy:

Event-specific and default attributes

There are metrics and attributes that are specific to a given event type. For example, the metric view.loading_time is associated with “view” RUM events and the attribute resource.method is associated with “resource” RUM events. And there are default attributes that are present on all RUM events. For example, the URL of the page (view.url) and user information such as their device type (device.type) and their country (geo.country).

Default attributes

Each of these event types has the following attributes attached by default. So you can use them regardless of the RUM event type being queried.

Core

Attribute nameTypeDescription
typestringThe type of the event (for example, view or resource).
application.idstringThe Datadog application ID.

View attributes

RUM action, error, resource and long task events contain information about the active RUM view event at the time of collection:

Attribute nameTypeDescription
view.idstringRandomly generated ID for each page view.
view.loading_typestringThe type of page load: initial_load or route_change. For more information, see the single page applications support docs.
view.referrerstringThe URL of the previous web page from which a link to the currently requested page was followed.
view.urlstringThe view URL.
view.url_hashstringThe hash part of the URL.
view.url_hoststringThe host part of the URL.
view.url_pathstringThe path part of the URL.
view.url_path_groupstringThe automatic URL group generated for similar URLs (for example, /dashboard/? for /dashboard/123 and /dashboard/456).
view.url_queryobjectThe query string parts of the URL decomposed as query params key/value attributes.
view.url_schemeobjectThe scheme part of the URL.

Device

The following device-related attributes are attached automatically to all events collected by Datadog:

Attribute nameTypeDescription
device.typestringThe device type as reported by the device (User-Agent HTTP header)
device.brandstringThe device brand as reported by the device (User-Agent HTTP header)
device.modelstringThe device model as reported by the device (User-Agent HTTP header)
device.namestringThe device name as reported by the device (User-Agent HTTP header)

Operating system

The following OS-related attributes are attached automatically to all events collected by Datadog:

Attribute nameTypeDescription
os.namestringThe OS name as reported by the by the device (User-Agent HTTP header)
os.versionstringThe OS version as reported by the by the device (User-Agent HTTP header)
os.version_majorstringThe OS version major as reported by the by the device (User-Agent HTTP header)

Geo-location

The following attributes are related to the geo-location of IP addresses:

FullnameTypeDescription
geo.countrystringName of the country
geo.country_iso_codestringISO Code of the country (for example, US for the United States, FR for France).
geo.country_subdivisionstringName of the first subdivision level of the country (for example, California in the United States or the Sarthe department in France).
geo.country_subdivision_iso_codestringISO Code of the first subdivision level of the country (for example, CA in the United States or the SA department in France).
geo.continent_codestringISO code of the continent (EU, AS, NA, AF, AN, SA, OC).
geo.continentstringName of the continent (Europe, Australia, North America, Africa, Antartica, South America, Oceania).
geo.citystringThe name of the city (example Paris, New York).

User attributes

In addition to default attributes, add user related data to all RUM event types by identifying user sessions. This lets you follow the journey of a given user, figure out which users are the most impacted by errors and monitor performance for your most important users.

Event-specific attributes

Session metrics

MetricTypeDescription
session.time_spentnumber (ns)Duration of the user session.
session.view.countnumberCount of all views collected for this session.
session.error.countnumberCount of all errors collected for this session.
session.resource.countnumberCount of all resources collected for this session.
session.action.countnumberCount of all actions collected for this session.
session.long_task.countnumberCount of all long tasks collected for this session.

Session attributes

Attribute nameTypeDescription
session.idstringRandomly generated ID for each session.view.
session.typestringThe type of session: user or synthetics. Sessions from Synthetic Monitoring Browser Tests are excluded from billing.
session.referrerstringThe URL of the previous web page from which a link to the currently requested page was followed.
session.initial_view.idstringThe id of the first RUM view generated by the user.
session.initial_view.url_hoststringThe host part of the URL.
session.initial_view.url_pathstringThe path part of the URL.
session.initial_view.url_path_groupstringThe automatic URL group generated for similar URLs (for example, /dashboard/? for /dashboard/123 and /dashboard/456).
session.initial_view.url_queryobjectThe query string parts of the URL decomposed as query params key/value attributes.
session.initial_view.url_schemeobjectThe scheme part of the URL.
session.last_view.idstringThe id of the last RUM view generated by the user.
session.last_view.url_hoststringThe host part of the URL.
session.last_view.url_pathstringThe path part of the URL.
session.last_view.url_path_groupstringThe automatic URL group generated for similar URLs (for example, /dashboard/? for /dashboard/123 and /dashboard/456).
session.last_view.url_queryobjectThe query string parts of the URL decomposed as query params key/value attributes.
session.last_view.url_schemeobjectThe scheme part of the URL.

Single page applications

For single page applications (SPAs), the RUM SDK differentiates between initial_load and route_change navigations with the loading_type attribute. If a click on your web page leads to a new page without a full refresh of the page, the RUM SDK starts a new view event with loading_type:route_change. RUM tracks page changes using the History API.

Datadog provides a unique performance metric, loading_time, which calculates the time needed for a page to load. This metric works both for initial_load and route_change navigations.

How is loading time calculated?

To account for modern web applications, loading time watches for network requests and DOM mutations.

  • Initial Load: Loading Time is equal to whichever is longer:

    • The difference between navigationStart and loadEventEnd.
    • Or the difference between navigationStart and the first time the page has no activity for more than 100ms (activity being defined as ongoing network requests or a DOM mutation).
  • SPA Route Change: Loading Time is equal to the difference between the user click and the first time the page has no activity for more than 100ms (activity being defined as ongoing network requests, or a DOM mutation).

Hash SPA navigation

Frameworks relying on hash (#) navigation are monitored with the RUM SDK automatically. The SDK watches for HashChangeEvent and issues a new view. Events coming from an HTML anchor tag which do not affect the current view context are ignored.

View timing metrics

RUM view performance metrics are collected from both the Paint Timing API and the Navigation Timing API.

MetricTypeDecription
view.time_spentnumber (ns)Time spent on the current view.
view.largest_contentful_paintnumber (ns)Moment in the page load timeline in which the largest DOM object in the viewport (i.e. visible on screen) is rendered.
view.first_input_delaynumber (ns)Time elapsed between a user’s first interaction with the page and the browser’s response.
view.cumulative_layout_shiftnumberQuantifies unexpected page movement due to dynamically loaded content (for example, third-party ads) where 0 means no shifts happening.
view.loading_timenumber (ns)Time until the page is ready and no network request or DOM mutation is currently occurring. More info on how view loading time is collected
view.first_contentful_paintnumber (ns)Time when the browser first renders any text, image (including background images), non-white canvas, or SVG. For more information about browser rendering, see the w3c definition.
view.dom_interactivenumber (ns)The moment when the parser finishes its work on the main document. More info from the MDN documentation
view.dom_content_loadednumber (ns)Event fired when the initial HTML document is completely loaded and parsed, without waiting for non-render blocking stylesheets, images, and subframes to finish loading. More info from the MDN documentation.
view.dom_completenumber (ns)The page and all the subresources are ready. For the user, the loading spinner has stopped spinning. More info from the MDN documentation
view.load_eventnumber (ns)Event fired when the page is fully loaded. Usually a trigger for additional application logic. More info from the MDN documentation
view.error.countnumberCount of all errors collected for this view.
view.long_task.countnumberCount of all long tasks collected for this view.
view.resource.countnumberCount of all resources collected for this view.
view.action.countnumberCount of all actions collected for this view.

Resource timing metrics

Detailed network timing data for the loading of an application’s resources are collected with the Performance Resource Timing API.

MetricTypeDescription
durationnumberEntire time spent loading the resource.
resource.sizenumber (bytes)Resource size.
resource.connect.durationnumber (ns)Time spent establishing a connection to the server (connectEnd - connectStart)
resource.ssl.durationnumber (ns)Time spent for the TLS handshake. If the last request is not over HTTPS, this metric does not appear (connectEnd - secureConnectionStart)
resource.dns.durationnumber (ns)Time spent resolving the DNS name of the last request (domainLookupEnd - domainLookupStart)
resource.redirect.durationnumber (ns)Time spent on subsequent HTTP requests (redirectEnd - redirectStart)
resource.first_byte.durationnumber (ns)Time spent waiting for the first byte of response to be received (responseStart - RequestStart)
resource.download.durationnumber (ns)Time spent downloading the response (responseEnd - responseStart)

Resource attributes

AttributeTypeDescription
resource.typestringThe type of resource being collected (for example, css, javascript, media, XHR, image).
resource.methodstringThe HTTP method (for example POST, GET).
resource.status_codenumberThe response status code.
resource.urlstringThe resource URL.
resource.url_hoststringThe host part of the URL.
resource.url_pathstringThe path part of the URL.
resource.url_queryobjectThe query string parts of the URL decomposed as query params key/value attributes.
resource.url_schemestringThe protocol name of the URL (HTTP or HTTPS).
resource.provider.namestringThe resource provider name. Default is unknown.
resource.provider.domainstringThe resource provider domain.
resource.provider.typestringThe resource provider type (for example first-party, cdn, ad, analytics).

Long task timing metrics

MetricTypeDescription
long_task.durationnumberDuration of the long task.

Error sources

Front-end errors are split in 4 different categories depending on their error.source:

  • network: XHR or Fetch errors resulting from AJAX requests.
  • source: Unhandled exceptions or unhandled promise rejections (source-code related).
  • console: console.error() API calls.
  • custom: Errors sent with the RUM addError API default to custom.

Error attributes

AttributeTypeDescription
error.sourcestringWhere the error originates from (for example, console or network).
error.typestringThe error type (or error code in some cases).
error.messagestringA concise, human-readable, one-line message explaining the event.
error.stackstringThe stack trace or complementary information about the error.

Network errors

Network errors include information about failing HTTP requests. The following facets are also collected:

AttributeTypeDescription
error.resource.status_codenumberThe response status code.
error.resource.methodstringThe HTTP method (for example POST, GET).
error.resource.urlstringThe resource URL.
error.resource.url_hoststringThe host part of the URL.
error.resource.url_pathstringThe path part of the URL.
error.resource.url_queryobjectThe query string parts of the URL decomposed as query params key/value attributes.
error.resource.url_schemestringThe protocol name of the URL (HTTP or HTTPS).
error.resource.provider.namestringThe resource provider name. Default is unknown.
error.resource.provider.domainstringThe resource provider domain.
error.resource.provider.typestringThe resource provider type (for example first-party, cdn, ad, analytics).

Source errors

Source errors include code-level information about the error. More information about the different error types can be found in the MDN documentation.

AttributeTypeDescription
error.typestringThe error type (or error code in some cases).

Automatic collection of actions

Real User Monitoring (RUM) SDKs detect user interactions performed during a user journey. Set the trackInteractions initialization parameter to true to enable this feature.

Note: The trackInteractions initialization parameter enables the collection of user clicks in your application. Sensitive and private data contained on your pages may be included to identify the elements interacted with.

Once an interaction is detected, all new RUM events are attached to the ongoing action until it is considered finished. The action also benefits from its parent view attributes such as browser information, geolocation data, global context.

How is the action loading time calculated?

Once an interaction is detected, the RUM SDK watches for network requests an DOM mutations. It is considered finished once the page has no activity for more than 100ms (activity being defined as ongoing network requests or DOM mutations).

Custom user actions

Custom user actions are user actions declared and sent manually via the addAction API. They can send information relative to an event occurring during a user journey, for example, a custom timing or customer cart information.

Action timing metrics

MetricTypeDescription
action.loading_timenumber (ns)The loading time of the action. See how it is calculated in the User Action documentation.
action.long_task.countnumberCount of all long tasks collected for this action.
action.resource.countnumberCount of all resources collected for this action.
action.error.countnumberCount of all errors collected for this action.

Action attributes

AttributeTypeDescription
action.idstringUUID of the user action.
action.typestringType of the user action. For Custom User Actions, it is set to custom.
action.target.namestringElement that the user interacted with. Only for automatically collected actions
action.namestringUser-friendly name created (for example Click on #checkout). For Custom User Actions, the action name given in the API call.

Further Reading