> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devtune.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Cloudflare pull

> Measure AI crawls, answer fetches and 404 demand on a Cloudflare-proxied hostname with a read-only API token. No code changes.

DevTune pulls hourly AI crawler analytics from Cloudflare's GraphQL analytics API. Nothing is installed on your site, and your request volume never reaches DevTune — only aggregated hourly buckets do. The API token is stored encrypted and used only for readonly analytics pulls.

Cloudflare pulls don't include requests from the Qwen Code, Crush and Aider coding agents; edge middleware does.

When Cloudflare includes the sending address, DevTune uses it to [check the crawler's identity](https://docs.devtune.ai/ai-traffic/advanced-setup.md#crawler-identity-checks) and then discards it. Without an address, the traffic stays visible with its identity unknown.

## Before you start

* A paid plan that includes AI Traffic, and project management permission. See [Set up AI Traffic](https://docs.devtune.ai/ai-traffic/setup.md#before-you-start).
* A Cloudflare zone serving the hostname you want to measure.

Confirm the hostname is **proxied** by Cloudflare — the orange cloud in your DNS records. Cloudflare has no analytics for a hostname it does not proxy, so a grey-cloud record returns nothing.

## Create a read-only API token

1. In the Cloudflare dashboard, go to **My Profile → API Tokens → Create Token**, then **Create Custom Token**.

2. Configure the token:

   | Setting | Value |
   | - | - |
   | Permissions | **Zone → Analytics → Read**. Add **Zone → Zone → Read** if you want DevTune to list your zones for you. |
   | Zone resources | The specific zone serving the hostname you are measuring, or all zones in the account. |
   | TTL | Leave open-ended. An expiring token stops the hourly sync when it lapses. |

   Nothing else is needed. Do not grant edit permissions — DevTune only reads.

3. Copy the **Zone ID** for that zone. It is on the zone's **Overview** page in Cloudflare, in the **API** panel on the right.

## Add the source

In **Settings › Integrations**, open **Cloudflare** under **Crawler sensors**:

1. Under **Cloudflare source**, paste the **Zone ID** and the **API token**.
2. Give the source a **Label** so you can recognize it later, such as `example.com zone`. If you leave it blank, DevTune names it after the zone ID.
3. Select **Save source**.

A source holds one zone's credentials. Reuse it for every hostname in that zone; create a second source only for a second zone.

## Add a hostname

Once a source is saved, the **Hostname** section appears:

1. Select the **Tracked domain** this connection reports into. Only domains already tracked on the project appear here — add the domain in **Settings** first if it is missing.
2. Check the **Cloudflare hostname**. DevTune prefills the tracked domain's hostname; change it if the traffic you want arrives on a different hostname in the same zone, such as `docs.example.com`.
3. Select **Add hostname**.

Add one connection per hostname you want measured. A zone serving `example.com` and `docs.example.com` needs two.

## What happens next

The sync runs hourly, on the hour. The most recent minutes wait for the next sync, because Cloudflare has not finished counting them. The first sync reaches back up to 30 days, limited to the history the zone's Cloudflare plan keeps, so a new connection arrives with last month's crawls already in it. If an older day has more traffic than Cloudflare returns in one read, the backfill stops there instead of recording partial counts. Changing a connection's hostname, path prefix or source restarts it from the previous 24 hours.

Because Cloudflare reports the real edge status for everything it proxies, missing pages reach 404 Demand with no extra work on your side.

## Check Cloudflare is working

1. Wait for the next hourly sync. Until it runs, the hostname reads **Waiting for first sync**.
2. In **Settings › Integrations**, reload the page. The **Cloudflare** row reads **Active**, with **Last synced** and the time of the sync.
3. Open **Insights › AI Traffic** and select **Crawls & fetches**. The first sync's backfill appears here, so a hostname that AI crawlers already visit shows data straight away.

If the row reports a sync problem instead, see [If Cloudflare stops syncing](#if-cloudflare-stops-syncing).

## If Cloudflare stops syncing

When Cloudflare rejects the token, the source reports **Cloudflare needs reconnecting** and syncing pauses for every hostname using it. Select **Update API token** on that message and save a replacement. Syncing resumes on the next hourly run.

For any other failure, the sensor reports **Cloudflare sync needs attention. Update the connection if the issue persists.** Check, in order:

* The token still carries **Zone → Analytics → Read** for that zone.
* The zone ID matches the zone that serves the hostname.
* The hostname is still orange-cloud proxied.
* The connection is enabled rather than disabled.

## Managing and removing a connection

Each connection row carries its own controls:

* **Disable** stops the hourly pull and keeps the connection and its history. **Enable** resumes it.
* **Delete** removes the connection, and removes the stored credential when no other hostname is using that source.
* To change the hostname on an existing connection, select its tracked domain under **Hostname**, edit the field, and select **Update hostname**.
* To rotate the API token, select **Add source**, re-enter the same **Zone ID** with the new token, and save. DevTune replaces the stored credential and reactivates every hostname on that source.

Keep a hostname on one crawler sensor at a time. If you move a hostname from Cloudflare pull to edge middleware, disable or delete its Cloudflare connection. See [Keep each site on one crawler sensor](https://docs.devtune.ai/ai-traffic/choosing-sensors.md#keep-each-site-on-one-crawler-sensor).

## Next steps

* **[Set up AI Traffic](https://docs.devtune.ai/ai-traffic/setup.md)** - connect website analytics, Search Console and the tracking snippet
* **[Reading AI Traffic](https://docs.devtune.ai/ai-traffic/dashboard.md)** - what each view counts
* **[Crawler identity checks](https://docs.devtune.ai/ai-traffic/advanced-setup.md#crawler-identity-checks)** - what each verdict means


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.