Skip to content

RumSite

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.

const site = yield* Cloudflare.RumSite("Analytics", {
host: "example.com",
});
// Embed in your HTML — contains the site token:
const snippet = site.snippet;

Orange-clouded site with automatic snippet injection

const zone = yield* Cloudflare.Zone("Zone", { name: "example.com" });
yield* Cloudflare.RumSite("ZoneAnalytics", {
zoneTag: zone.zoneId,
autoInstall: true,
});

Skip injection for EU visitors

yield* Cloudflare.RumSite("ZoneAnalytics", {
zoneTag: zone.zoneId,
autoInstall: true,
lite: true,
});