mirror of
https://github.com/citeworthyio/seo-agent.git
synced 2026-08-11 13:22:39 +02:00
A fourth kind, `search`, for a human arriving from a search engine, so a self-hoster with a bound TELEMETRY D1 can see which engines send them traffic. SEARCH_REFERRER_RE matches the referrer HOSTNAME, anchored both ends, so google.com matches and gemini.google.com cannot; Google ccTLDs are matched structurally rather than enumerated. The AI check runs first as an else-if and now matches the HOSTNAME too. Before this it tested the full referrer URL, so a Google search whose query string mentioned an AI product — /search?q=is+claude.ai+good — was recorded as an AI referral, inflating the one number this tap exists to measure and storing a row whose kind and host contradicted each other. Anyone could mint AI referrals with a crafted Referer. Same-site referrers are no longer classified at all; duck.ai added to the AI list; the readers that enumerate kinds (analytics, dashboard, telemetry, mcp) learned the new one — analytics.ts would otherwise have silently dropped it. Host-only is now stated as a privacy guarantee in the header and schema, with a test that a referrer carrying a query string and fragment records only the host. The docs no longer overclaim: an AI surface answering from a search engine's own host (Google AI Mode, Bing Copilot, DDG and Kagi assistants) is counted as search, so `referral` is a floor on AI traffic, not a total. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>