Cloudflare.Rum reference
Source:
src/Cloudflare/Rum/Rule.ts
A Cloudflare Web Analytics (RUM) rule.
Rules include or exclude traffic from Web Analytics measurement by
hostname and path patterns. They live under the implicit ruleset of a
zone-based (orange-clouded) Site — pass the site’s rulesetId
attribute. Host, paths, inclusive, and isPaused are all mutable in
place; changing rulesetId triggers a replacement.
Web Analytics is available on free accounts.
Rule: Excluding traffic
Section titled “Rule: Excluding traffic”const zone = yield* Cloudflare.Zone.Zone("Zone", { name: "example.com" });
const site = yield* Cloudflare.Rum.Site("Analytics", { zoneTag: zone.zoneId, autoInstall: true,});
yield* Cloudflare.Rum.Rule("ExcludeAdmin", { rulesetId: site.rulesetId.as<string>(), host: "example.com", paths: ["/admin/*"], inclusive: false,});Rule: Pausing a rule
Section titled “Rule: Pausing a rule”yield* Cloudflare.Rum.Rule("ExcludeAdmin", { rulesetId: site.rulesetId.as<string>(), host: "example.com", paths: ["/admin/*"], inclusive: false, isPaused: true,});Source:
src/Cloudflare/Rum/Site.ts
A Cloudflare Web Analytics (RUM) site.
A site measures real-user performance for either a plain hostname
(gray-clouded — embed the produced snippet yourself) or a Cloudflare
zone (orange-clouded — set autoInstall to inject the snippet at the
edge). The site is identified by its auto-assigned siteTag; host and
autoInstall are mutable in place, while switching between host and
zoneTag identity models (or changing zoneTag) triggers a replacement.
Web Analytics is available on free accounts.
Site: Measuring a hostname
Section titled “Site: Measuring a hostname”const site = yield* Cloudflare.Rum.Site("Analytics", { host: "example.com",});
// Embed in your HTML — contains the site token:const snippet = site.snippet;Site: Measuring a zone
Section titled “Site: Measuring a zone”Orange-clouded site with automatic snippet injection
const zone = yield* Cloudflare.Zone.Zone("Zone", { name: "example.com" });
yield* Cloudflare.Rum.Site("ZoneAnalytics", { zoneTag: zone.zoneId, autoInstall: true,});Skip injection for EU visitors
yield* Cloudflare.Rum.Site("ZoneAnalytics", { zoneTag: zone.zoneId, autoInstall: true, lite: true,});