πΈ Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
/**
* AI operators, and the referrer domains that belong to each.
*
* This is the join key between the two halves of a site's AI story, which are
* collected by completely different code paths and would otherwise never meet:
*
* - **Crawls** β `bot_events.bot_operator`, written during bot detection from
* the curated user-agent patterns.
* - **Referrals** β `events` rows whose `channel` is `"AI"`, classified from the
* referrer domain.
*
* Put next to each other they answer the question a site owner actually has β
* "this company read 4,000 of my pages; did it send anyone back?" β so both
* sides have to spell an operator's name identically. That is why the mapping
* lives here rather than being written out twice.
*
* The `operator` values must match the `operator` field on the curated bot
* patterns in `server/src/services/tracker/botBlocking/uaBots/patterns.ts`.
*/
export const AI_OPERATOR_REFERRER_DOMAINS: Record<string, string[]> = {
OpenAI: ["chatgpt.com", "chat.openai.com"],
Anthropic: ["claude.ai"],
Google: ["gemini.google.com", "aistudio.google.com", "notebooklm.google.com"],
// edgeservices.bing.com is Copilot in the Edge sidebar; the *.cloud.microsoft
// hosts are the Microsoft 365 Copilot web app (m365 β copilot redirect, 2026).
Microsoft: ["copilot.microsoft.com", "copilot.cloud.microsoft", "m365.cloud.microsoft", "edgeservices.bing.com"],
Perplexity: ["perplexity.ai"],
Meta: ["meta.ai"],
Mistral: ["chat.mistral.ai", "mistral.ai"],
xAI: ["grok.com"],
"You.com": ["you.com"],
// Only duck.ai, DuckDuckGo's chat: a referral from duckduckgo.com is organic
// search, not an AI chat hand-off, and listing it here would reclassify
// every DuckDuckGo visit as AI traffic.
DuckDuckGo: ["duck.ai"],
Cursor: ["cursor.com"],
Cohere: ["coral.cohere.com"],
Manus: ["manus.im"],
ByteDance: ["doubao.com"],
};
/**
* Referrer domain β operator, flattened. Lookups are by the domain form the
* events table stores (`domainWithoutWWW(referrer)`).
*/
export const AI_REFERRER_DOMAIN_TO_OPERATOR: Record<string, string> = Object.fromEntries(
Object.entries(AI_OPERATOR_REFERRER_DOMAINS).flatMap(([operator, domains]) =>
domains.map(domain => [domain, operator] as const)
)
);
/**
* AI chat domains that have no crawler counterpart in the bot patterns. They
* still belong to the AI acquisition channel β someone arrived from them β but
* there is no operator to attribute crawls to, so they are kept apart from the
* mapping above rather than given a made-up operator name.
*/
export const AI_CHAT_ONLY_DOMAINS: string[] = [
"deepseek.com",
"chat.deepseek.com",
"poe.com",
"pi.ai",
"heypi.com",
"character.ai",
"qwen.ai",
"jasper.ai",
"writesonic.com",
"chatsonic.com",
"phind.com",
"andi.com",
"codeium.com",
"kimi.com",
"kimi.moonshot.cn",
"chat.qwen.ai",
"chat.z.ai",
"chatglm.cn",
"yuanbao.tencent.com",
"genspark.ai",
"t3.chat",
];
/** Every domain that counts as AI chat traffic, for channel classification. */
export const AI_CHAT_DOMAINS: string[] = [
...Object.keys(AI_REFERRER_DOMAIN_TO_OPERATOR),
...AI_CHAT_ONLY_DOMAINS,
];