Skip to main content

Tracker docs

Track AI traffic with Cloudflare Workers

The edge Worker records recognized AI crawler requests and recognized AI answer referrals before traffic reaches your origin. It uses a hostname-bound public workspace identifier, never a secret API key.

1. Install the tracker

npm install @foglift/tracker@^1.4.0

2. Add the generated Worker

Open AI Traffic while signed in to copy this entrypoint with your workspace identifier filled in. The adapter reports a matched request and passes the original request through to your origin unchanged.

// src/worker.ts
import { trackAITrafficWorker } from "@foglift/tracker/cloudflare";

export default {
  fetch: trackAITrafficWorker({
    siteToken: "YOUR_WORKSPACE_ID",
  }),
};

Matched reports stay alive through ctx.waitUntil, so Foglift reporting does not delay the response.

3. Assign the route safely

Configure the Worker route for your hostname, such as example.com/*. Do not replace an existing Worker route or overwrite its bindings, compatibility settings, or fetch behavior. If a Worker already owns that route, review the integration before deployment.

npx wrangler dev
npx wrangler deploy

4. Verify the server signal

  1. Confirm the Worker route is active on the intended production hostname.
  2. Open AI Traffic and keep the page listening.
  3. Request a routed page with a recognized AI-crawler user agent. Foglift confirms the first server-observed event.

The tracker sends the matched agent role, request path, and referrer hostname only. Query strings, request bodies, cookies, and page content are not reported. A crawler request does not prove indexing or citation.

Open AI Traffic