Before you start
- Your domain is proxied through Cloudflare (orange cloud).
- You have a RankRaft AI site key. See Your site key.
Set up
1
Get your site key
In RankRaft AI, open Integrations, choose Cloudflare and click Create site key. Copy it.
2
Create a Worker
In your Cloudflare dashboard, go to Workers & Pages → Create → Start with Hello World!. Name it
rankraft-ai and click Deploy.3
Paste our code
Click Edit code, delete everything in the editor, paste the code shown on the RankRaft AI Integrations page (
worker.js), then click Deploy.4
Add your site key
In the Worker, open Settings → Variables and Secrets → Add. Choose type Secret, name it
RANKRAFT_SITE_KEY, paste your key as the value, and click Deploy.5
Send your site's traffic through it
Open Settings → Domains & Routes → Add → Route. Pick your zone and enter the route
example.com/*.Set Failure mode to Fail open, so your site keeps working even if the Worker hits a limit.If visitors also use www.example.com, add a second route www.example.com/*.6
Check it's working
Open your site in a new tab, then press Check again at the top of the RankRaft AI Integrations page. It turns green within a minute of the first visit.
Cloudflare’s free plan includes 100,000 Worker requests a day. A busier site needs Workers Paid ($5/month on Cloudflare).
Configuration
Deploying with Wrangler
If you manage Workers as code, deploy the same script with awrangler.jsonc like this:
wrangler.jsonc
What it sends
For each request, after the response has been returned to the visitor: timestamp, host, method, path, query string, visitor IP (CF-Connecting-IP), user agent, referrer, response status, response size, country and ASN. WebSocket upgrades and excluded paths are skipped. The Worker never modifies the request or the response.
Troubleshooting
- Still “Waiting for your first data”. Check the route matches the hostname you visited (
wwwvs apex), and that the secret is named exactlyRANKRAFT_SITE_KEY. - Data stopped after rotating the key. Paste the new key into the Worker’s secret and deploy.
- Cloudflare’s “Block AI Scrapers and Crawlers” setting. If it’s on (under Security → Bots), Cloudflare blocks AI crawlers before they reach your Worker or your site. Turn it off if you want AI engines to read your site.