- Docs
- Connections
- Connect Cloudflare
Connect Cloudflare
Count AI bot visits from Cloudflare's analytics. Create a user API token with two read permissions, paste it in Settings, and Knownwise syncs once a day.
If your site runs behind Cloudflare, Knownwise can read AI bot visits from Cloudflare's analytics. Nothing is added to your site. This is also the route for static sites, which have no server to run tracking code.
The Cloudflare card is in Settings → Integrations, in the AI bot visits for section of each brand. It reads Counts AI bot visits from Cloudflare's analytics. Nothing to add to your site. Cloudflare connections are on paid plans.
Create the token
Knownwise needs a user API token, the kind you create under your own Cloudflare profile. An account API token (under Manage Account) will not work, because Knownwise checks the token through Cloudflare's user token check.
- Sign in to the Cloudflare dashboard. Open your profile (the person icon, top right) → My Profile → API Tokens.
- Choose Create Token, then Create Custom Token → Get started.
- Give the token a name, such as "Knownwise".
- Under Permissions, add two rows:
- Zone → Analytics → Read
- Zone → Zone → Read
- Under Zone Resources, choose Include → Specific zone → the zone for your brand's domain. For a brand on
blog.example.com, the zone isexample.com. - Leave everything else as it is. Choose Continue to summary, then Create Token.
- Copy the token. Cloudflare shows it only once.
The token can read analytics and zone details. It cannot change anything in your Cloudflare account.
Paste it in Knownwise
- In Settings → Integrations, find the brand and the Cloudflare card.
- Choose Connect Cloudflare.
- Paste the token into Cloudflare API token and choose Connect. The button reads Checking the token… while Knownwise checks it.
Knownwise checks four things, in order. Cloudflare must accept the token, the token must see a zone for your brand's domain, it must be allowed to read that zone's analytics, and your Cloudflare plan must give the user agent, page and status code of each request. Knownwise runs one small test query to be sure. Only then does Knownwise store the token, encrypted. Knownwise never shows the token again, and never puts it in error messages.
What happens next
- The first sync starts right away. The card shows the zone (Zone: and your domain) and the tracking card's route list shows Waiting for the first sync.
- The first sync goes back as far as your Cloudflare plan keeps these analytics, up to 30 days.
- After that, Knownwise syncs once a day at about 06:00 UTC and reads the last three UTC days again, so a day whose sync failed is filled in the next day. Reading a day again replaces its counts; it never adds them twice. Today's visits appear tomorrow.
- When a sync finishes, the route reads Receiving since and a date, and the AI bots page fills in.
Knownwise asks Cloudflare only for requests that came from AI bots to your brand's host (plus www. when the brand is on the bare domain), and only for the bot, page, day and status code. A brand on a subdomain counts only that subdomain, not the whole zone.
The card notes Cloudflare estimates these counts from a sample. On a very busy day Cloudflare can return its row limit. The card then adds The busiest days hit Cloudflare's row limit, so those counts are a floor.
Cloudflare visits are never marked verified. Cloudflare does report requests that its own firewall blocked, so the Refused column and the firewall check on the AI bots page work with Cloudflare data. See AI bot visits for what verified means.
If connecting fails
The form tells you what went wrong:
- Cloudflare has no zone for this brand's domain on this token. Check which zone the token covers. The token works but cannot see your domain. Check step 5, and check that the domain lives in the Cloudflare account you created the token in.
- The token is missing a permission. It needs Zone → Analytics → Read and Zone → Zone → Read. Edit the token in Cloudflare to add the missing row, or create a new one.
- Cloudflare didn't accept this token. Check that you copied all of it. Copy the token again. If you lost it, roll it in Cloudflare or create a new one. This also happens with an account API token instead of a user token.
- This zone's Cloudflare plan doesn't give the user agent, path and status of requests, so AI bot visits can't be counted from Cloudflare. Use the snippet instead. The token is fine, but the zone's plan does not offer these analytics. Nothing was saved.
- Too many tries this hour. Try again later. Each organization can try to connect 10 times an hour.
- That doesn't look like a Cloudflare API token. The pasted text is too short to be a token.
- Cloudflare didn't answer. Try again in a minute. Cloudflare's API did not respond. Nothing was saved.
If a sync fails later
The daily sync can also hit problems. The Cloudflare row in the AI bot tracking card then starts with Problem: and gives the reason:
- Cloudflare no longer accepts the token. Reconnect with a new one. The token was deleted, rolled or expired.
- the Cloudflare token is missing a permission. Reconnect with a new one. A permission was removed from the token.
- your Cloudflare plan doesn't give this data (user agent, path and status). The token is kept; the next sync tries again. The zone's plan changed.
- Cloudflare asked us to slow down. The next sync tries again. Nothing to do.
Only when Cloudflare no longer accepts the token does Knownwise delete it; the Cloudflare card then shows the same message. Choose Reconnect and paste a new token. In the other cases the token is kept and the next daily sync tries again.
When a sync fails while visits are still counting, the Cloudflare card keeps the time of the last good sync and adds The last sync failed: and the reason. The next sync reads the missed day again.
On the Free plan, including after a downgrade, Knownwise stops syncing. The token stays stored until you disconnect.
Disconnect
- Choose Disconnect on the Cloudflare card.
- Confirm Disconnect Cloudflare for this brand? Visits already counted stay.
Knownwise deletes the stored token and stops syncing. The card shows Disconnected and a Reconnect button. Visits already counted stay on the AI bots page.
The token still exists in Cloudflare. As the card says, To remove access completely, delete the token in Cloudflare too. You do that under My Profile → API Tokens.