Skip to content

RUM beacon for Web Analytics

The RUM beacon is a JavaScript snippet that runs when a Cloudflare customer enables RUM through Web Analytics or Observatory. This script runs in users' browsers when they visit the customer's site, and its purpose is to collect performance-related data, for example, page load time, and send it to Cloudflare's systems for processing. This data is then presented to the customer, providing valuable insights into the website's performance and usage.

The RUM beacon script can be enabled into a webpage in two ways:

  • One-click setup: For sites proxied through Cloudflare that have Web Analytics enabled, the snippet can be automatically injected into pages as the HTML response passes through Cloudflare's edge network to the browser by simply enabling the automatic injection option.

  • Manual setup: Websites can manually add the script by embedding a code snippet into their pages. Refer to the Sites not proxied through Cloudflare section, for more information about how to manually insert the snippet into your HTML.

Data collection

Once downloaded to the browser, the RUM beacon script runs as JavaScript in the browser. It collects performance data from browser APIs and sends this data to Cloudflare for processing.

The data collected from the browser is summarized in the table below:

FieldExampleDescriptionHow it is collected
pageloadId0c698922-8d60-40bf-85ac-7982b5f8034dThe unique ID for the page.Generated in the browser code.
referrerhttps://cfrumtest.com/The referring page URL.If it is a multi-page application (MPA), then it is generated from document.referrer. If it is a single-page application (SPA), then it is generated from a local in-memory variable in the beacon code which stores previous URLs.
startTime1693488419352Baseline for performance-related timestamps.performance.timeOrigin
memory{ totalJSHeapSize: 39973671, usedJSHeapSize: 39127515, jsHeapSizeLimit: 4294705152 }Measures memory heap size.performance.memory (deprecated)
timingsObject of PerformanceTimingTiming data.performance.timing (deprecated, fallback when timingV2 is unavailable)
timingV2Array of PerformanceNavigationTimingNavigation timing data.performance.getEntriesByType("navigation")
resourcesArray of PerformanceResourceTimingResource timing data.performance.getEntriesByType("resource")
firstPaintArray of PerformancePaintTimingPaint timing data.performance.getEntriesByType("paint")
firstContentfulPaint209First Contentful Paint metric.web-vitals module 1
FCP209First Contentful Paint metric.web-vitals module 1
LCP209Largest Contentful Paint metric.web-vitals module 1
CLS0.001Cumulative Layout Shift metric.web-vitals module 1
FID1.12First Input Delay metric.web-vitals module 1
TTFB0.03Time to First Byte metric.web-vitals module 1
INP1.23Interaction to Next Paint metric.web-vitals module 1
landingPathhttps://cfrumtest.com/The landing page URL.performance.getEntriesByType("navigation")

Data processing

RUM data is generally processed at the nearest Cloudflare data center based on how the incoming request is routed. This is determined by a number of factors including Anycast and Unimog. Since RUM data does not use location services, it may be processed in a different country or region from where it originated. Although the RUM service receives the client/source IP address from the beacon as part of normal HTTP request handling process, it discards the IP address at the nearest Cloudflare data center and does not store it in core databases or logs.

Privacy information

The RUM beacon script does not store any data in the browser or access any storage data, such as cookies, localStorage, sessionStorage, IP address, or IndexedDB. The data we collect is performance data from the browser performance APIs. This performance data is ephemeral and only relates to the current webpage that is being viewed. If the user refreshes their browser, all the previous performance data is gone and new performance data starts being available. This data is not stored or accessed from anywhere on the device, it is only available as in-memory data.

RUM excluding EEA/EU

Customers have the option to enable RUM globally or to limit its application to exclude users connecting to Cloudflare data centers in the EEA/EU. If the latter option is selected, the RUM beacon does not process performance data for users connecting to a Cloudflare data center located in the following countries (ISO codes): AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IS, IE, IT, LV, LI, LT, LU, MT, NL, NO, PL, PT, RO, SK, SI, ES, SE, CH, GB.

Enable RUM in the dashboard.

Footnotes

  1. The web-vitals module is an open-source module written by Google. It does not access any type of storage on the browser. 2 3 4 5 6 7