How It Works
A Cloudflare Worker sits in front of your entire website. Every request passes through it before reaching your origin server. When an AI bot is detected by User-Agent, the Worker logs it to the traffic-ingest-service as a non-blocking background task (ctx.waitUntil), then passes the request through to your origin unchanged.
Your real visitors never notice any difference.
Setup
Install the Wrangler CLI
Wrangler is Cloudflare’s official CLI for deploying Workers.Then log in to your Cloudflare account:
Create your Worker project
Create a new directory for the Worker (or use the
cloudflare-wroker folder from the downloaded files):Create the Worker files
worker.js — Copy the code below into this file:worker.js
wrangler.toml — Worker configuration:wrangler.toml
Replace
yourdomain.com with your actual domain. The Worker will intercept all traffic matching this pattern.Fill in your credentials
In
In
worker.js, replace:| Placeholder | Value |
|---|---|
<TRAFFIC_INGEST_SERVICE_URL> | The URL of the traffic-ingest-service (ask your Siftly admin) |
<YOUR_ORGANIZATION_ID> | Your Organisation ID UUID from the Siftly dashboard |
wrangler.toml, replace:| Placeholder | Value |
|---|---|
yourdomain.com | Your actual domain name |
Verifying It Works
After deploying, simulate an AI bot request to confirm events flow through:Updating the Worker
To change the endpoint URL or Organisation ID later:- Edit
worker.jswith the new values. - Run
wrangler deployagain.
Troubleshooting
Worker deployed but no events in Siftly
Worker deployed but no events in Siftly
- Confirm the route in
wrangler.tomlmatches your domain exactly. - Visit dash.cloudflare.com → Workers & Pages → your worker → Logs to see real-time request logs.
- Check the
LOG_ENDPOINTURL is correct and the service is reachable. - Test with
curl -A "GPTBot/1.0" https://yourdomain.comfrom a terminal.
The Worker is interfering with my site
The Worker is interfering with my site
The Worker calls
return fetch(request) at the end, which proxies the request to your origin unchanged. If something looks wrong, check that you haven’t modified this line.You can also add specific paths to an allowlist or denylist using the matcher pattern in wrangler.toml.I need to track multiple domains
I need to track multiple domains
Add multiple route entries to Each domain must be in your Cloudflare account.
wrangler.toml: