Cloudflare Worker
This guide walks you through configuring a Cloudflare Worker to stream request logs into AirOps for Agent Analytics.
This guide walks you through configuring Cloudflare to stream into AirOps via Workers. Once connected, AirOps automatically analyzes your traffic, classifies AI bot visits (ChatGPT, Claude, Perplexity, Google, and more), and surfaces insights in your Agent Analytics dashboard.
Prerequisites
An active AirOps account with Agent Analytics enabled
A Cloudflare account serving your website that is either at the Enterprise tier or has the Workers Paid add-on
A development machine with Node.js installed
Your Workspace API key, available in
Settings → WorkspaceYour Brand Kit ID, available in the URL by navigating to
Context → Brand Kits. The URL takes the formhttps://app.airops.com/<YOUR_WORKSPACE_SLUG>/data/brand_kits/<YOUR_BRAND_KIT_ID>
Workers Batching
The batching integration is the recommended approach for most websites. It uses a Cloudflare Queue to buffer per-request log events and flush them to AirOps in batches, keeping you well under the AirOps rate limit even at high traffic volumes.
Step 1: Initialize the Cloudflare Worker
For this process, we will use version 2.68.2 of the Cloudflare CLI. Other minor versions may work, but there may be differences in the CLI prompts.
Set the directory to airops-log-collector.

Set the starting example to Hello World example.

Set the template to Queue consumer & producer Worker.

Set the language to TypeScript.

Choose Yes for using git for version control.

Choose No for deploying your application (we will do this later).

Step 2: Configure the Cloudflare Worker Route
Edit the wrangler.json file and configure your pattern, zone_name, queue bindings, and AIROPS_API_URL.
Step 3: Configure the Cloudflare Worker Code
Replace the contents of the src/index.ts file with the following code.
Step 4: Configure the AirOps API Key

Step 5: Create the Cloudflare Queue
Step 6: Deploy the Cloudflare Worker
Step 7: Verify the Connection
After deploying the Cloudflare Worker, data should begin flowing within 2-5 minutes.
Generate some traffic to your website.
In your AirOps dashboard, navigate to Agent Analytics. Traffic data should appear shortly.
Workers Alternate
The alternate integration approach sends an event to AirOps on every page visit. This is best suited for websites with fewer page visits to avoid exceeding rate limits and therefore is not recommended for most websites.
Step 1: Initialize the Cloudflare Worker
For this process, we will use version 2.68.2 of the Cloudflare CLI. Other minor versions may work, but there may be differences in the CLI prompts.
Set the directory to airops-log-collector.

Set the starting example to Hello World example.

Set the template to Worker only.

Set the language to TypeScript.

Choose Yes for using git for version control.

Choose No for deploying your application (we will do this later).

Step 2: Configure the Cloudflare Worker Route
Edit the wrangler.json file and configure your pattern, zone_name, and AIROPS_API_URL.
Step 3: Configure the Cloudflare Worker Code
Replace the contents of the src/index.ts file with the following code.
Step 4: Configure the AirOps API Key
Step 5: Deploy the Cloudflare Worker
Step 6: Verify the Connection
After deploying the Cloudflare Worker, data should begin flowing within 2-5 minutes.
Generate some traffic to your website.
In your AirOps dashboard, navigate to Agent Analytics. Traffic data should appear shortly.
Rate Limits
The AirOps ingestor enforces a rate limit of 5 requests per minute per API key. The real-time Worker sends one request per page visit, so this option is best suited for lower-traffic sites. For high-traffic sites, batch requests or use a buffered ingestion option.
What AirOps Tracks
Once connected, AirOps automatically:
Ingests all Cloudflare requests: page views, assets, and API calls
Classifies AI bot traffic: identifies visits from ChatGPT, Claude, Google, Perplexity, Meta, Apple, Bing, Bytedance, Common Crawl, and others
Categorizes crawl behavior: distinguishes between AI training crawlers, AI search fetches, AI indexing, and user-initiated AI browsing
Surfaces analytics: traffic breakdowns, bot-vs-human ratios, and crawl trends in your dashboard
Last updated
Was this helpful?