Skip to content

Analytics

vanityURLs analytics runs inside the Cloudflare Worker. It does not require browser tracking JavaScript, cookies, or a visitor account.

Cloudflare Web Analytics and Real User Measurement (RUM) are not part of the vanityURLs baseline. Leave Cloudflare RUM disabled unless an operator intentionally wants browser-side performance telemetry outside the redirector’s server-side event model.

The Worker sends analytics with ctx.waitUntil().1 Redirects and pages should continue responding even when the analytics provider is slow or unavailable.

Provider limits are account- and product-specific. Verify the current vendor documentation and the plan attached to the instance before enabling high-volume collection.

The Worker uses collection endpoints for runtime analytics. Treat management API keys, reporting APIs, helper scripts, and collection events as separate paths with separate limits and credentials.

References: Fathom API documentation, Umami sending stats documentation, and Umami Cloud API-key documentation.

Configuration Fields

Configure analytics with Worker variables in wrangler.toml and Worker secrets when a helper script needs an API token.

FieldScopePurpose
ANALYTICS_PROVIDERWorker variabledisabled, umami, fathom, or umami,fathom
UMAMI_ENDPOINTWorker variableUmami collection endpoint, usually https://cloud.umami.is/api/send
UMAMI_WEBSITE_IDWorker variable or secretUmami website ID used for collection
UMAMI_GEO_IP_MODEWorker variableControls whether the Worker forwards visitor IP information to Umami
UMAMI_BOT_MODEWorker variableUse original to keep original event names for known bots instead of normalizing them to bot
FATHOM_SITE_IDWorker variable or secretFathom site ID used for collection
FATHOM_ENDPOINTWorker variableFathom collection endpoint, usually https://cdn.usefathom.com/
FATHOM_BOT_MODEWorker variableUse original to keep original event names for known bots instead of normalizing them to bot
FATHOM_API_TOKENLocal secretOptional management API token for local helper scripts; not needed by the Worker for collection

Events

EventWhen it is sent
pageviewA static or status HTML page returns successfully
redirectA short link resolves to a target
short-link-missA request looks like a short-link candidate but no slug matches
lookupThe /lookup page records lookup activity through POST /_analytics/lookup after resolving a slug with POST /lookup/resolve
botA known bot triggers an event and bot normalization is enabled

Localized lookup pages use these public paths:

LanguagePath
English/lookup
French/fr/consultation
Spanish/es/consulta
Italian/it/consulta
German/de/abfrage

Scanner probes matched by the runtime blocklist return a plain 404 before analytics. Common PHP and WordPress probes should not pollute miss metrics.

Requests blocked by Cloudflare before the Worker do not emit vanityURLs analytics events. Use Cloudflare Security Events and Cloudflare analytics for traffic blocked by Access, WAF, rate limiting, bot controls, crawler controls, DNS, or TLS policy.

Cloudflare analytics surfaces are reference tools, not setup requirements:

  • Security Events: traffic blocked before the Worker by WAF, rate limiting, Access, bot controls, or AI Crawl Control
  • Workers analytics: infrastructure request volume, errors, CPU time, wall time, and duration
  • DNS Analytics: DNS diagnostics when investigating routing or delegation issues
  • Web Analytics / RUM: disabled by default and not planned for the baseline

Umami Payload

Umami receives pageviews as native pageviews. Redirect, miss, lookup, and normalized bot activity are sent as named events with structured event data.

Umami payloads include:

  • website ID
  • requested URL
  • referrer
  • first language tag from Accept-Language
  • visitor user agent or a safe bot fallback user agent
  • visitor IP according to UMAMI_GEO_IP_MODE

Non-pageview event data can include:

  • event type
  • slug
  • target host
  • effective lifecycle state
  • schedule label
  • redirect status
  • redirect error or lookup result, when present
  • country and colo from Cloudflare request metadata
  • correlation ID
  • requested path and query
  • bot family, when detected

Fathom Payload

Fathom receives provider-native collection requests from the Worker. Pageviews are sent as pageviews; redirect, miss, lookup, and bot activity are sent as named Fathom events.

Fathom request fields include:

  • site ID
  • page origin
  • page path
  • referrer
  • selected query and campaign parameters
  • generated client ID for the collection request
  • event name for non-pageview events
  • event payload for non-pageview events

Fathom event payloads can include:

  • event type
  • slug
  • target host
  • effective lifecycle state
  • schedule label
  • redirect status
  • redirect error or lookup result, when present
  • country and colo from Cloudflare request metadata
  • correlation ID
  • requested path and query

IP Mode

UMAMI_GEO_IP_MODE controls whether the Worker forwards CF-Connecting-IP to Umami.

ValueBehavior
fullSends the full visitor IP for more accurate geo reports
truncated or unsetSends an anonymized IP
noneOmits IP override entirely

Fathom collection does not require forwarding CF-Connecting-IP from the Worker. The Worker sends provider-native Fathom requests with the visitor user agent when safe, and falls back to a generic Worker user agent for known bot traffic.


  1. ctx.waitUntil() is called from src/worker.mjs, the main vanityURLs application run by Cloudflare Workers. ↩︎

Edit this page Last modified: