PostHog setup
Track AI assistant traffic in PostHog
PostHog web analytics defines the channel type AI as "A link from an AI assistant, e.g. ChatGPT, Claude, or Perplexity" and classifies visits by UTMs and referring domains. The dashboard page we read documents no referrer filter and no regex operator, so a custom filter on $referring_domain is unverified syntax until you confirm it in your project.
Last checked · How we check
On this page
Copy the filter for PostHog
Hostnames
Only hostnames with a test or a vendor source.
UTM variants
For hand-made tags such as utm_source=chatgpt.
9 values for posthog.
Channel type = AI
PostHog documents the channel type AI: a link from an AI assistant, for example ChatGPT, Claude or Perplexity.
$referring_domain matches regex ^(copilot\.microsoft\.com|chat\.deepseek\.com|gemini\.google\.com|chat\.mistral\.ai|perplexity\.ai|chatgpt\.com|www\.meta\.ai|grok\.x\.com|claude\.ai)$
The dashboard page we read does not document a regex operator for referrers. Check that your filter menu offers it.
match(properties.$referring_domain, '^(copilot\\.microsoft\\.com|chat\\.deepseek\\.com|gemini\\.google\\.com|chat\\.mistral\\.ai|perplexity\\.ai|chatgpt\\.com|www\\.meta\\.ai|grok\\.x\\.com|claude\\.ai)$')
Uses the standard property $referring_domain. Backslashes are doubled because HogQL string literals treat a backslash as an escape. We have not run it against a PostHog project.
Checked locally in your browser against the pattern above.
Syntax unverified9 values
- Syntax for the referrer filter is unverified: the documentation page we read does not show it. Prefer the native AI channel and test any custom filter on a known visit.
- The list holds exact hostnames. A www. variant (for example www.chatgpt.com) is recognised by the referrer checker but is not in this pattern; add it if your reports show it.
Built from the referrer list (checked ). Settings are not saved; the page works offline once loaded.
What is documented
| Topic | PostHog's page says | Status |
|---|---|---|
| Channel type AI | A link from an AI assistant, e.g. ChatGPT, Claude, or Perplexity | Documented |
| How it classifies | Through UTMs and referring domains | Documented |
| Session attribution explorer | Shows the session count for each combination of channel type, referrer and UTM | Documented |
| Referrer as a dashboard filter | Not listed among the filters on the page we read | Open |
| Regex operator | Not mentioned on that page | Unverified |
A referring-domain filter
$referring_domain is PostHog's standard property for the referrer host. The generator prints two forms: a property filter with the operator "matches regex" and a HogQL expression using match(). We have not run either against a PostHog project, and the page we read does not show the operator, so they are labelled unverified.
- Start with the native channel type AI in the dashboard and the session attribution explorer.
- To cross-check, add a property filter on the referring domain and look for a regex operator in the menu.
- If your menu has no regex operator, run the HogQL form in a SQL insight instead.
- Test with a known click. If the count looks wrong, trust the native channel over the custom filter.
Limits
- Classification needs a referrer or a UTM. Clicks without either are not AI visits to PostHog. See why AI clicks end up as Direct.
- PostHog's page names three assistants as examples. It does not publish a hostname list.
Follow-up questions
Which assistants does the AI channel include?
The documentation gives ChatGPT, Claude and Perplexity as examples and does not list the rest. Use the explorer to see which referrers land in the channel in your data.
Is the HogQL snippet safe to paste?
It only reads a property and compares it with a pattern; it changes nothing. It is unverified for syntax, so run it on a small date range first.
Sources
Read on . Links lead to the original pages.