Referrer classifier
This helper applies the documented precedence: utm_source and utm_medium, then a known ad-click id, then a normalized referrer host. The Go classifier in production is the source of truth if they ever disagree.
Known assistant hosts
chatgpt.com, chat.openai.com, and searchgpt.com become source chatgpt. claude.ai becomes claude. perplexity.ai becomes perplexity. gemini.google.com and bard.google.com become gemini. copilot.microsoft.com becomes copilot. you.com, phind.com, deepseek.com, chat.mistral.ai, lechat.mistral.ai, meta.ai, grok.x.com, and pi.ai are also ai_assistant. Medium is ai_assistant. Same-host referrers and Stripe or PayPal checkout hosts stay direct. google.com/search?q=gemini stays organic. bing.com/chat stays Bing organic. x.com/i/grok stays X social. kagi.com and openai.com stay referral. A host that starts with google. is organic only when the rest is a real TLD suffix such as com or co.uk. Crawler User-Agents are not referrers.
Related