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.
Download the Worker code
Grab our Worker that uses HTMLRewriter to inject the script before the closing </head> tag.
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.
Paste the Worker code
Replace the default code with the contents of web-tracking-cloudflare-worker.js. Save and deploy.
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.
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
- Open your site in a private/incognito window.
- Visit any page on the site.
- Open the Web-Tracking.eu dashboard for this site.
- 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.