Cloudflare Bot Detection Setup Guide

Complete guide to setting up AI bot detection for your website using Cloudflare Workers.

Why Cloudflare Workers?
Understanding why we use Cloudflare for bot detection

✅ Edge Detection

Bot detection happens at Cloudflare's edge servers, before your website even loads. This means we catch bots that don't execute JavaScript.

✅ Real-time Logging

Every bot visit is logged instantly to your Aiso dashboard, giving you immediate insights into AI bot traffic.

✅ Free Plan Available

Cloudflare Workers free plan includes 100,000 requests per day, which is more than enough for most websites.

✅ No Code Changes

Unlike server-side solutions, you don't need to modify your website's code. The Worker runs transparently.

Prerequisites
What you need before getting started

1. Cloudflare Account

You need a Cloudflare account (free plan works perfectly). If you don't have one:

Sign up for Cloudflare

2. Website on Cloudflare

Your website domain needs to be added to Cloudflare. This is required for Workers to intercept requests.

3. Workers Enabled

Cloudflare Workers need to be enabled for your account. This is usually enabled by default on free plans.

Step-by-Step Setup
Complete setup process from start to finish
1

Generate Your API Key

Go to the integration page and enter your email and website domain to get a unique API key.

2

Create Cloudflare Worker

In your Cloudflare dashboard, create a new Worker and paste the pre-configured code.

Detailed steps:

  1. 1. Go to Workers dashboard
  2. 2. Click "Create a Service"
  3. 3. Choose "HTTP handler"
  4. 4. Copy the worker code from the integration page
  5. 5. Paste it into the editor
  6. 6. Click "Save and Deploy"
3

Configure Routes

Set up routes so the Worker intercepts requests to your website.

Route configuration:

  • • Go to the "Triggers" tab in your Worker
  • • Click "Add route"
  • • Enter your domain pattern: yourdomain.com/*
  • • Click "Add route" to save
4

Test Your Setup

Verify that bot detection is working by testing with AI bots.

Testing methods:

  • • Ask ChatGPT to visit your website
  • • Ask Claude to visit your website
  • • Check your analytics dashboard for new visits
  • • Look at Cloudflare Worker logs for detection messages
Troubleshooting
Common issues and how to fix them

No bot visits showing up

Check: Make sure your route pattern covers all pages (use yourdomain.com/*). Verify the Worker is deployed and active. Check Cloudflare Worker logs for any errors.

Worker deployment fails

Check: Ensure you copied the entire worker code correctly. Check that your API key is properly inserted. Verify you have Workers enabled on your Cloudflare account.

Route not working

Check: Make sure your domain is properly added to Cloudflare and DNS is configured correctly. The route pattern should match your domain exactly (including www if applicable).

API errors in logs

Check: Verify your API key is correct and active. Check that the webhook URL is properly configured. Contact support if the issue persists.

Frequently Asked Questions
Common questions about bot detection setup

Do I need to modify my website code?

No! The Cloudflare Worker runs transparently and doesn't require any changes to your website's code.

Will this slow down my website?

No, Cloudflare Workers run at the edge and add minimal latency (usually less than 1ms). In fact, they often improve performance.

What bots are detected?

We detect ChatGPT-User, GPTBot, ClaudeBot, PerplexityBot, MetaExternalAgent, and other major AI bots. The list is regularly updated.

Is there a free plan?

Yes! The basic bot detection is free. Cloudflare Workers free plan includes 100,000 requests per day, which covers most websites.

Can I use this with any website?

Yes, as long as your website is on Cloudflare. This includes WordPress, React, Vue, static sites, and any other web technology.

Ready to Get Started?
Begin setting up bot detection for your website