Skip to main content
Integration

WebmasterID on Cloudflare

Sites on Cloudflare Pages or behind the Cloudflare CDN use WebmasterID with the standard consent-gated script tag. No Cloudflare app or partnership is required.

Add the tracker

For GDPR/ePrivacy, load the tracker only after analytics consent. The pattern below is the same consent-gated approach documented in Privacy & GDPR — inject it from your consent manager when the analytics category is granted, not unconditionally.

<script
  id="webmasterid-tracker"
  defer
  src="https://webmasterid.com/tracker.iife.min.js"
  data-wmid="wm_xxxxxxxxxxxxxxxx"
  data-endpoint="https://webmasterid-ingest-api.vercel.app/api/events">
</script>

CSP & security headers

If you add a CSP via Cloudflare Transform Rules or your origin, allow https://webmasterid.com in script-src and the ingest endpoint in connect-src.

Caching

The tracker script is static and cacheable. Avoid caching consent state; the consent manager runs per-visitor in the browser.

  • Pages or proxied CDN both work.
  • Single shared include.
  • Consent-gated load only.

Cloudflare Pages

On Cloudflare Pages, add the consent-gated loader to the shared layout of your framework or static site generator, so it is written into every page at build time. To set a CSP on Pages, add a _headers file to the output directory:

/*
  Content-Security-Policy: script-src 'self' https://webmasterid.com; connect-src 'self' https://webmasterid-ingest-api.vercel.app

Merge these sources into your existing policy rather than replacing it.

Sites proxied through Cloudflare

When your own server sits behind the Cloudflare proxy, the tag is added at the origin as on any other site. Two Cloudflare features deserve a check:

  • Rocket Loader rewrites and delays scripts. If the tracker loads late or not at all, add data-cfasync="false" to the tag or turn Rocket Loader off for the site.
  • Workers are optional. If you cannot edit the origin templates, a Worker using HTMLRewriter can insert the same consent-gated loader into each HTML response.

Check that it works

  1. Purge the Cloudflare cache for HTML pages after adding the tag.
  2. Open the site in a private window, accept analytics and confirm in the Network tab that the tracker loads once and events reach the ingest endpoint.
  3. Check the browser console for CSP violations; they name the directive that needs the extra source.

FAQ

Cloudflare app needed?

No — this is a standard script-tag integration; no official app/partnership implied.

Will the CDN break it?

No. Allow the script and endpoint in CSP and it works behind the CDN.

Workers required?

No. It is client-side; Workers are optional and not needed.

Does Rocket Loader affect the tracker?

It can delay or reorder it. Add data-cfasync="false" to the script tag or disable Rocket Loader if events go missing.

Can I add it without editing my site?

Yes, with a Cloudflare Worker that uses HTMLRewriter to insert the consent-gated loader into each page. Editing your templates is simpler when you can.

Related

Related tools

HELPERG ecosystem

Owned, lightweight,
privacy-conscious

WebmasterID is designed for website visibility you control. Explore the product, docs, and integrations.