Back to integrations
Cloudflare

Cloudflare

Enhance your website's AI SEO with our Cloudflare Agent integration. Monitor AI interactions and optimize your content for better visibility in AI search results.

The Cloudflare Agent integration enables edge-based AI bot tracking via Cloudflare Workers. Deploy once and track all major AI systems including GPTBot, PerplexityBot, ClaudeBot, and more across your entire site. The integration provides real-time alerts, seamlessly pipes AI visibility data into your existing SEO reports, and helps you compare traditional rankings with LLM coverage - all with zero impact on site performance.

What is Cloudflare AI SEO Tracking?

Our Cloudflare Agent integration provides a seamless way to track AI interactions with your website. Deploy through Cloudflare Workers for efficient, edge-based tracking of how AI systems interact with your content. This solution works with any website hosted on Cloudflare and requires minimal configuration. The edge-based approach ensures fast performance and comprehensive tracking across all pages.

What Features Does the Cloudflare AI Tracker Offer?

  • Deploy via Cloudflare Workers
  • Edge-based AI tracking
  • Zero impact on site performance
  • Global distribution
  • Automatic updates and maintenance
  • Works with any website on Cloudflare
  • No code changes to your actual website
  • Identifies all major AI bots and crawlers

What Do I Need to Set Up Cloudflare AI Tracking?

  • Cloudflare account
  • Website hosted on Cloudflare or using Cloudflare DNS
  • API key from xseek
  • Website ID from your xseek dashboard

How Do I Set Up AI Tracking with Cloudflare Workers?

  1. 1

    Ensure AI bots are allowed through Cloudflare's WAF and security settings

  2. 2

    Create a Cloudflare Worker in your Cloudflare dashboard

  3. 3

    Add our AI bot detection code to the worker

  4. 4

    Set up environment variables with your API key and website ID

  5. 5

    Configure a route pattern to direct traffic through the worker

  6. 6

    Deploy the worker to start tracking AI visits

Integration Setup

Environment Variables Required

Add these environment variables to your project:

XSEEK_API_KEY=your_api_keyXSEEK_WEBSITE_ID=your_website_id

Your API key can be found in your account settings. Make sure it has the ai_visits:push privilege.

1Create a Cloudflare Worker

Log in to your Cloudflare dashboard, go to Workers, and create a new worker with this code:

// Cloudflare Worker - AI Bot Detection with patterns from xSeek's bot database
// Add secrets: wrangler secret put XSEEK_API_KEY && wrangler secret put XSEEK_WEBSITE_ID

const AI_BOTS = [
  { name: 'anthropic-ai', pattern: /anthropic-ai/i },
  { name: 'claudebot', pattern: /ClaudeBot/i },
  { name: 'claude-web', pattern: /claude-web/i },
  { name: 'claude-user', pattern: /Claude-User/i },
  { name: 'claude-searchbot', pattern: /Claude-SearchBot/i },
  { name: 'perplexitybot', pattern: /PerplexityBot/i },
  { name: 'perplexity-user', pattern: /Perplexity-User/i },
  { name: 'grokbot', pattern: /GrokBot(?!.*DeepSearch)/i },
  { name: 'grok-search', pattern: /xAI-Grok/i },
  { name: 'grok-deepsearch', pattern: /Grok-DeepSearch/i },
  { name: 'GPTBot', pattern: /GPTBot/i },
  { name: 'chatgpt-user', pattern: /ChatGPT-User/i },
  { name: 'oai-searchbot', pattern: /OAI-SearchBot/i },
  { name: 'google-extended', pattern: /Google-Extended/i },
  { name: 'applebot', pattern: /Applebot(?!-Extended)/i },
  { name: 'applebot-extended', pattern: /Applebot-Extended/i },
  { name: 'meta-external', pattern: /meta-externalagent/i },
  { name: 'meta-externalfetcher', pattern: /meta-externalfetcher/i },
  { name: 'bingbot', pattern: /Bingbot(?!.*AI)/i },
  { name: 'bingpreview', pattern: /bingbot.*Chrome/i },
  { name: 'microsoftpreview', pattern: /MicrosoftPreview/i },
  { name: 'cohere-ai', pattern: /cohere-ai/i },
  { name: 'cohere-training-data-crawler', pattern: /cohere-training-data-crawler/i },
  { name: 'youbot', pattern: /YouBot/i },
  { name: 'duckassistbot', pattern: /DuckAssistBot/i },
  { name: 'semanticscholarbot', pattern: /SemanticScholarBot/i },
  { name: 'ccbot', pattern: /CCBot/i },
  { name: 'ai2bot', pattern: /AI2Bot/i },
  { name: 'ai2bot-dolma', pattern: /AI2Bot-Dolma/i },
  { name: 'aihitbot', pattern: /aiHitBot/i },
  { name: 'amazonbot', pattern: /Amazonbot/i },
  { name: 'novaact', pattern: /NovaAct/i },
  { name: 'brightbot', pattern: /Brightbot/i },
  { name: 'bytespider', pattern: /Bytespider/i },
  { name: 'tiktokspider', pattern: /TikTokSpider/i },
  { name: 'cotoyogi', pattern: /Cotoyogi/i },
  { name: 'crawlspace', pattern: /Crawlspace/i },
  { name: 'pangubot', pattern: /PanguBot/i },
  { name: 'petalbot', pattern: /PetalBot/i },
  { name: 'semrushbot-ocob', pattern: /SemrushBot-OCOB/i },
  { name: 'semrushbot-swa', pattern: /SemrushBot-SWA/i },
  { name: 'sidetrade-indexer', pattern: /Sidetrade indexer bot/i },
  { name: 'timpibot', pattern: /Timpibot/i },
  { name: 'velenpublicwebcrawler', pattern: /VelenPublicWebCrawler/i },
  { name: 'omgili', pattern: /omgili/i },
  { name: 'omgilibot', pattern: /omgilibot/i },
  { name: 'webzio-extended', pattern: /Webzio-Extended/i },
  { name: 'baiduspider', pattern: /Baiduspider/i }
];

export default {
  async fetch(request, env) {
    const userAgent = request.headers.get('user-agent') || '';
    const ip = request.headers.get('cf-connecting-ip') || '';
    
    let detectedBot = null;
    for (const bot of AI_BOTS) {
      if (bot.pattern.test(userAgent)) {
        detectedBot = bot.name;
        break;
      }
    }

    const response = await fetch(request);

    if (detectedBot && env.XSEEK_API_KEY && env.XSEEK_WEBSITE_ID) {
      fetch('https://www.xseek.io/api/track-ai-bot', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json', 'x-api-key': env.XSEEK_API_KEY },
        body: JSON.stringify({
          botName: detectedBot,
          userAgent,
          url: request.url,
          ip: ip || undefined,
          referer: request.headers.get('referer') || undefined,
          websiteId: env.XSEEK_WEBSITE_ID,
        }),
      }).catch(e => console.error('Tracking error:', e));
    }

    return response;
  },
};

2Deploy your Worker

After saving your worker, set up a route to direct traffic through it. Go to the "Triggers" tab and add a route pattern:

yourdomain.com/*

This will process all requests through your worker, enabling AI bot detection across your entire site.

All set!

Your Cloudflare-powered website is now tracking AI crawler visits. Data will appear in the xseek dashboard soon.

Frequently Asked Questions

How can I pipe AI visibility stats into my existing SEO reports so I can compare traditional rankings with LLM coverage?

Export and compare AI visibility data from your Cloudflare based AI tracking with your traditional SEO reports by pairing xSeek data via API or CSV exports to your reporting tool. Build a combined dashboard that shows AI coverage alongside keyword rankings, traffic, and conversions for side-by-side analysis.

What tools provide actionable insights for answer engine optimization?

AI SEO tools with Cloudflare based tracking surface actionable insights by identifying which pages trigger AI answers, which prompts generate visibility, and where gaps appear. Use edge level data to optimize content, metadata, and internal linking, then translate findings into prioritized changes and targeted performance alerts.

What is the OpenAI GPTBot user agent and IP ranges official documentation?

OpenAI GPTBot user agent strings and IP ranges are defined by OpenAI. For the latest details, refer to OpenAI official documentation. The Cloudflare Agent integration detects major AI bots including GPTBot and routes their visits to your AI SEO dashboards for analysis.

What is the Perplexity AI crawler user agent PerplexityBot documentation?

Perplexity AI crawler uses PerplexityBot; official user agent and IP range details are provided by Perplexity in their documentation. While using the Cloudflare Agent integration you can detect PerplexityBot traffic and include it in your AI SEO analysis to measure impact on coverage and visibility.

How do AI SEO tools measure share of voice within AI answer snippets compared to traditional SERP rankings?

AI SEO tools measure share of voice by aggregating visible AI answer coverage with traditional SERP rankings. Track AI driven impressions, clicks, and position relative to standard results, then compare trends over time. Use dashboards that separate AI snippet visibility from traditional results for clear comparisons.

Which solutions offer real-time alerts and reporting for LLM ranking analysis?

The Cloudflare Agent integration provides real-time alerts and reporting for LLM ranking analysis. It tracks AI bot visits at the edge via Cloudflare Workers, updates dashboards automatically, and integrates with your existing SEO reports so you can monitor shifts in AI driven and traditional rankings in near real time.

Need more help?

Check our comprehensive documentation for detailed instructions.

View documentation