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

# Connect Cloudflare to Bot Analytics

> Connect your website's Cloudflare account so Bot Analytics can count AI bot visits, and fix a Cloudflare connection that stops working.

Connect Cloudflare so Bot Analytics can count AI bot visits from your website's Cloudflare logs. Slate creates a Logpush job in your Cloudflare account that sends bot requests only.

> [!NOTE]
>
> Bot Analytics is available to selected workspaces. Ask your Slate contact to turn it on for your workspace.

## Why It Matters

Cloudflare handles every request to the hostnames it proxies. Its logs show each AI bot visit, with no change to your website's code.

## Before You Start

* Your website runs through Cloudflare, with its DNS records proxied (orange cloud).
* You can create API tokens in that Cloudflare account.
* You have the **Admin** role in your Slate workspace. Other people see "Ask a workspace admin to connect Cloudflare."
* Logpush is turned on for the Cloudflare account. If it isn't, Slate tells you during the install. See [Troubleshooting](#troubleshooting).

## Step 1: Create an API Token

1. Open [AI Visibility](https://slatehq.com/docs/ai-tracker/overview.md#where-to-find-it), then select **Bot Analytics** under **Website**.
2. Click **Connect Cloudflare**. The **Connect Cloudflare** dialog opens on **API token**.
3. Click **Open Cloudflare ↗**. Cloudflare opens the page for creating a token. Under **Zone Resources**, pick your site's zone.
4. Give the token these permissions on the zone:

| Permission | Access | What Slate uses it for |
| - | - | - |
| Zone | Read | Find your zone and its plan |
| Analytics | Read | Estimate requests a day |
| Logs | Edit | Send bot requests to Slate (Logpush) |
| Bot Management | Read | See if Cloudflare blocks AI bots |
| Zone WAF | Read | Name rules that block bots |
| Zone Settings | Read | Check Crawler Hints and other settings |

5. Create the token in Cloudflare and copy it. Cloudflare shows it only once.
6. Back in Slate, paste the token and click **Check**.

Slate checks each permission and marks it ✓ or ✕. **Zone** and **Logs** are required. The others are optional, but some checks on the page need them. Slate can't see your DNS records, billing, or other zones.

7. Click **Continue**.

## Step 2: Choose the Zone and Hostnames

1. Under **Zone**, choose your site's zone.
2. Under **Hostnames to count**, select the hostnames whose bot visits Slate should count. Each shows its traffic a day over the last 7 days. Slate preselects your main domain and its `www.` version when they have traffic.
3. Click **Install**.

You can choose up to 10 hostnames, all in the same zone.

You don't need to add a DNS record to prove you own the site. Managing the zone in Cloudflare is enough.

## Step 3: Install

Slate shows each step as it finishes:

1. **Logpush job created**: a job in your Cloudflare account that sends bot requests only, and skips static files such as images and scripts.
2. **Cloudflare reached Slate**: Cloudflare sent its check file to Slate.
3. **Last 30 days imported**: Slate brings in daily totals for the 30 days before you connected.

The install usually takes under a minute. You can close the dialog while it runs. When it's done, click **Go to Bot Analytics**.

> [!WARNING]
>
> **Undo install** removes the Logpush job and deletes the bot data Slate has collected for the site. Slate doesn't ask you to confirm.

## Your Last 30 Days

While the 30-day import runs, a banner says **Importing your last 30 days from Cloudflare**. Live bot visits are counted already. If the import fails, admins can click **Retry importing**.

The imported days are daily totals from Cloudflare Analytics. They're approximate, and Slate can't check them against each company's IP addresses. From the moment you connect, Slate checks every request. The chart marks where live data starts.

## Cloudflare Connection Problems

The status next to the page title shows whether bot requests are arriving. [Check that data is arriving](https://slatehq.com/docs/bot-analytics/connect-your-website.md#check-that-data-is-arriving) lists the states every platform shares. Cloudflare adds two more:

| Status | What it means |
| - | - |
| **Token stopped working** | Cloudflare refused Slate's token. It was deleted or lost a permission. The Logpush job keeps sending bot requests, but Slate's settings checks stop. |
| **Job turned off** | The Logpush job was deleted or turned off in Cloudflare. Slate misses bot requests until it runs again. If the job was turned off, turn it back on in Cloudflare under **Analytics & Logs › Logpush**. |

## Troubleshooting

**Cloudflare doesn't recognise this token.** Cloudflare shows a token only once. Create a new token and paste it.

**This token can't see any zone.** In Cloudflare, add your site's zone under **Zone Resources** for the token.

**The token can't send logs.** In Cloudflare, edit the token, add **Zone › Logs › Edit**, then click **Check again**.

**Logpush isn't turned on for this Cloudflare account.** In Cloudflare, open the zone, then **Analytics & Logs › Logpush**, and turn it on. Then click **Try again**.

**Cloudflare wants billing turned on.** Logpush on this account needs a payment method first. Add one in Cloudflare, then try again.

**Cloudflare refused a change.** Check that the token has **Logs › Edit** on this zone, then try again.

**The status shows No data.** Most often, the site's DNS record in Cloudflare was switched to DNS only (grey cloud), so requests no longer pass through Cloudflare. Turn the proxy back on for the record. If Cloudflare reported an error, hover over the red **Nothing from Cloudflare** chip to read it.

## What's Next

* [Connect your website](https://slatehq.com/docs/bot-analytics/connect-your-website.md): the connection status, and the platforms Bot Analytics supports
* [Bot Analytics](https://slatehq.com/docs/bot-analytics/overview.md): read the visits, pages, and errors


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