Advanced

Install Web-Tracking.eu on Cloudflare Workers

Inject the tracking script at the edge with a Cloudflare Worker. Useful when you cannot edit the origin's HTML or want central control across many sites.

1

Download the Worker code

Grab our Worker that uses HTMLRewriter to inject the script before the closing </head> tag.

2

Create a Worker

In the Cloudflare dashboard go to Workers & Pages > Create > Worker. Give it a name like web-tracking-injector and click Deploy. After it deploys, click Edit code.

Screenshot: Cloudflare Workers create screen
3

Paste the Worker code

Replace the default code with the contents of web-tracking-cloudflare-worker.js. Save and deploy.

4

Set the SITE_ID variable

In the Worker's Settings > Variables add an environment variable:

  • SITE_ID = your site ID from the Web-Tracking.eu dashboard

Save and redeploy.

5

Add a route

Open the zone for your site in Cloudflare. Go to Workers Routes and add a route like example.com/* pointing to your Worker. Every HTML response will now have the tracking script injected.

Verify it's working

  1. Open your site in a private/incognito window.
  2. Visit any page on the site.
  3. Open the Web-Tracking.eu dashboard for this site.
  4. The Realtime view should show your visit within 5–10 seconds.

Having trouble?

  • No data showing: Confirm the script is in the page source (View Source > search web-tracking.eu/t.js).
  • Wrong site ID: Double-check the ID matches the one in your dashboard. IDs are case-sensitive.
  • Ad blocker: Web-Tracking.eu is privacy-friendly, but some aggressive blockers still hide it. Test in a fresh browser.
  • Caching: Many platforms cache the page HTML. Purge your cache after install.
  • Still stuck? Email hello@web-tracking.eu with your site URL.
← Back to install hub