Skip to main content

Overview

Cloudflare RUM (Real User Monitoring) provides visibility into how real users experience your website. Collect performance metrics, monitor Core Web Vitals, and analyze user behavior.

Initialize the client

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: 'your-api-token',
});

Site info

Manage RUM sites.

Create a site

Create a new RUM site configuration.
const site = await client.rum.siteInfo.create({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
  host: 'example.com',
  zone_tag: 'zone-id-here',
});
account_id
string
required
Account identifier
host
string
required
Hostname to monitor
zone_tag
string
Associated zone identifier
id
string
Site identifier
host
string
Monitored hostname
created
string
When the site was created

Update a site

Update an existing RUM site.
const site = await client.rum.siteInfo.update(
  siteId,
  {
    account_id: '023e105f4ecef8ad9ca31a8372d0c353',
    host: 'updated.example.com',
  }
);

List sites

List all RUM sites in an account.
const sites = await client.rum.siteInfo.list({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

Get a site

Get details of a specific RUM site.
const site = await client.rum.siteInfo.get(
  siteId,
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }
);

Delete a site

Delete a RUM site.
await client.rum.siteInfo.delete(
  siteId,
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }
);

Rules

Manage RUM sampling and collection rules.

Create a rule

Create a new RUM rule.
const rule = await client.rum.rules.create({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
  site_tag: 'site-id-here',
  // rule configuration
});
account_id
string
required
Account identifier
site_tag
string
required
Site identifier

Update a rule

Update an existing RUM rule.
const rule = await client.rum.rules.update(
  ruleId,
  params
);

List rules

List all RUM rules.
const rules = await client.rum.rules.list({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

Delete a rule

Delete a RUM rule.
await client.rum.rules.delete(
  ruleId,
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }
);

Bulk create rules

Create multiple RUM rules at once.
const result = await client.rum.rules.bulkCreate({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
  rules: [
    // array of rule configurations
  ],
});

Types

Site

RUM site configuration.
id
string
Site identifier
host
string
Monitored hostname
zone_tag
string
Associated zone ID
auto_install
boolean
Whether RUM is auto-installed
created
string
Creation timestamp

RUMRule

RUM sampling and collection rule.
id
string
Rule identifier
site_tag
string
Associated site ID
enabled
boolean
Whether the rule is active
priority
number
Rule priority

Use cases

RUM is useful for:
  • Performance monitoring: Track Core Web Vitals (LCP, FID, CLS)
  • User experience: Understand real-world performance across devices and locations
  • Debugging: Identify slow pages and performance bottlenecks
  • Business insights: Correlate performance with business metrics
  • Optimization: Make data-driven decisions to improve site speed

Build docs developers (and LLMs) love