Analytics shows people who click through from ChatGPT. It doesn't show whether ChatGPT read your page in the first place, because crawlers don't run JavaScript.
My sites run on Cloudflare Workers, so every request goes through my code anyway. Counting crawlers there took about a hundred lines.
One table
CREATE TABLE crawl_daily ( day TEXT, path TEXT, bot TEXT, status TEXT, hits INTEGER, PRIMARY KEY (day, path, bot, status) ); One row per day, page, crawler and status. No IPs, no user-agent strings, nothing about people. Each crawler request bumps a counter:
const UPSERT = `INSERT INTO crawl_daily (day, path, bot, status, hits) VALUES (?1, ?2, ?3, ?4, 1) ON CONFLICT (day, path, bot, status) DO UPDATE SET hits = hits + 1`; Which crawlers
Only ones whose vendor documents the user-agent token. A few things I learned reading those docs:
- OpenAI has three.
ChatGPT-Usermeans someone asked ChatGPT and it opened your page.OAI-SearchBotbuilds the search index.GPTBotis for training. -
Google-Extendednever appears in a request. It's a robots.txt switch, nothing more. - If I couldn't open a vendor's docs page, I left that crawler out.
Matching is a lowercase substring check. User agents are easy to fake, so every number really means "requests claiming to be X". Good enough for spotting patterns.
Don't slow anything down
Only page URLs count, plus robots.txt, sitemap.xml and llms.txt. The write happens after the response with ctx.waitUntil, and it can't throw:
export default { async fetch(request, env, ctx) { const response = await respond(request, env, new URL(request.url)); recordCrawl(request, new URL(request.url), response.status, env, ctx); return response; }, }; What it showed
Within a day it paid off. I'd published a batch of pages that were only in the sitemap, with no links from anywhere else. OAI-SearchBot and bingbot hadn't fetched a single one, while happily crawling everything they could reach through links. So I linked the new pages from the home page and related guides.
I also watch the gap between fetches and visits. ChatGPT opening a page a lot while few people arrive from chatgpt.com is a different problem from never being read at all.
Cost is one D1 write per crawler page view. Nothing for people.
If you play the heist game ROB RUN, my player wiki for it is ROB RUN Wiki.