RUM Browser Data Collected
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

RUM Browser Data Collected

By default, all data collected is kept at full granularity for 15 days. The Datadog Real User Monitoring script sends five main types of events to Datadog:

  • View: Each time a user goes on a page of the setup application, a view event is created. While the user remains on that view, all data collected is attached to that view with the view.id attribute.
  • Resource: A resource event can be generated for images, XHR/Fetch, CSS, or JS libraries. It contains information about the resource, like its name and its associated loading duration.
  • Long task: Any task in a browser that blocks the main thread for more than 50ms is considered a long task and gets a specific event generation.
  • Error: Every time a frontend error is emitted by the browser, RUM catches it and sends it as an Error Event to Datadog.
  • User Action: A User Action event is a custom event that can be generated for a given user action.

A page view represents a user visiting a page from your website. During that page view, errors, resources, long tasks, and user actions get attached to that page view with a unique view.id attribute. Note that a page view gets updated as new events are collected.

For page views, loading performance metrics are collected from both the Paint Timing API and the Navigation Timing API.

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.

Metrics collected

AttributeTypeDecription
durationnumber (ns)Time spent on the current view.
view.loading_timenumber (ns)Time until the page is ready and no network request or DOM mutation is currently occurring. More info from the data collected documentation
view.measures.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 w3 definition.
view.measures.dom_interactivenumber (ns)The moment when the parser finishes its work on the main document. More info from the MDN documentation
view.measures.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.measures.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.measures.load_event_endnumber (ns)Event fired when the page is fully loaded. Usually a trigger for additional application logic. More info from the MDN documentation
view.measures.error_countnumberCount of all errors collected so far for this view.
view.measures.long_task_countnumberCount of all long tasks collected for this view.
view.measures.resource_countnumberCount of all resources collected for this view.
view.measures.user_action_countnumberCount of all user actions collected for this view.

All of your website’s resources are collected by default: images, XHRs, XMLHttpRequest, CSS files, JS assets, and font files.

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

Measure Collected

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

Facet Collected

AttributeTypeDescription
resource.kindstringThe kind or type of resource being collected (ex: CSS, JS, media, XHR, image)
http.status_codenumberThe response status code.
http.urlstringThe resource URL.
http.url_details.hoststringThe HTTP host part of the URL.
http.url_details.pathstringThe HTTP path part of the URL.
http.url_details.queryStringobjectThe HTTP query string parts of the URL decomposed as query params key/value attributes.
http.url_details.schemestringThe protocol name of the URL (HTTP or HTTPS)

Long tasks are tasks that block the main thread for 50 milliseconds or more. They may cause high input latency, delayed time to interaction, etc. Understand what causes these long tasks in your browser performance profiler.

Measure Collected

AttributeTypeDescription
durationnumberDuration of the long task.

Front-end errors are collected with Real User Monitoring (RUM). The error message and stack trace are included when available.

Error Origins

Front-end errors are split in 3 different categories depending on their error.origin:

  • network: XHR or Fetch errors resulting from AJAX requests. Specific attributes to network errors can be found in the documentation.
  • source: Unhandled exceptions or unhandled promise rejections (source-code related).
  • console: console.error() API calls.

Facet Collected

AttributeTypeDescription
error.originstringWhere the error originates from (for example, the console or network).
error.kindstringThe error type or kind (or 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
http.status_codenumberThe response status code.
http.urlstringThe resource URL.
http.url_details.hoststringThe HTTP host part of the URL.
http.url_details.pathstringThe HTTP path part of the URL.
http.url_details.queryStringobjectThe HTTP query string parts of the URL decomposed as query params key/value attributes.
http.url_details.schemestringThe protocol name of the URL (HTTP or HTTPS)

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.kindstringThe error type or kind (or code in some cases).

Automatic Collection of User 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 user action until it is considered finished. The user action also benefits from its parent view attributes such as browser information, geolocation data, global context.

How is the User Action duration 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 addUserAction API. They can send information relative to an event occurring during a user journey, for example, a custom timing or customer cart information.

Measures Collected

AttributeTypeDescription
durationnumber (ns)The length of the user action. See how it is calculated in the User Action documentation.
user_action.measures.long_task_countnumberCount of all long tasks collected for this user action.
user_action.measures.resource_countnumberCount of all resources collected for this user action.
user_action.measures.user_action_countnumberCount of all user actions collected for this user action.

Facet Collected

AttributeTypeDescription
user_action.idstringUUID of the user action.
user_action.typestringType of the user action. For Custom User Actions, it is set to custom.
event.namestringName of the user action. For automatically collected User Actions, the element which the user interacted with.

Default attributes

These five event categories have attributes attached by default:

Core

Attribute nameTypeDescription
application_idstringThe Datadog application ID.
session_idstringThe session ID.

View Attribute

Attribute nameTypeDescription
view.idstringRandomly generated ID for each page view.
view.urlstringThe view URL.
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.url_details.hoststringThe HTTP host part of the URL.
view.url_details.pathstringThe HTTP path part of the URL.
view.url_details.path_groupstringAutomatic URL group generated for similar URLs. (ex: /dashboard/? For /dashboard/123 and /dashboard/456)
view.url_details.queryStringobjectThe HTTP query string parts of the URL decomposed as query params key/value attributes.

User Agent

The following contexts—following the Datadog Standard Attributes logic—are attached automatically to all events sent to Datadog:

Attribute nameTypeDescription
http.useragent_details.os.familystringThe OS family reported by the User-Agent.
http.useragent_details.browser.familystringThe browser Family reported by the User-Agent.
http.useragent_details.device.familystringThe device family reported by the User-Agent.
http.useragent_details.device.categorystringThe device category reported by the User-Agent.

Geolocation

The following attributes are related to the geolocation of IP addresses used in network communication. All fields are prefixed by network.client.geoip or network.destination.geoip.

FullnameTypeDescription
network.client.geoip.country.namestringName of the country
network.client.geoip.country.iso_codestringISO Code of the country (example: US for the United States, FR for France)
network.client.geoip.continent.codestringISO code of the continent (EU, AS, NA, AF, AN, SA, OC)
network.client.geoip.continent.namestringName of the continent (Europe, Australia, North America, Africa, Antartica, South America, Oceania)
network.client.geoip.subdivision.namestringName of the first subdivision level of the country (example: California in the United States or the Sarthe department in France)
network.client.geoip.subdivision.iso_codestringISO Code of the first subdivision level of the country (example: CA in the United States or the SA department in France)
network.client.geoip.city.namestringThe name of the city (example Paris, New York)

Extra Attribute

In addition to default attributes, add specific global context to all events collected. This provides the ability to analyze the data for a subset of users. For example, group errors by user email, or understand which customers have the worst performance.

Further Reading