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

Assistants

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.

Native: channel type
Channel type = AI

PostHog documents the channel type AI: a link from an AI assistant, for example ChatGPT, Claude or Perplexity.

Property filter (verify the operator in your project)
$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.

HogQL (verify in your project)
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

TopicPostHog's page saysStatus
Channel type AIA link from an AI assistant, e.g. ChatGPT, Claude, or PerplexityDocumented
How it classifiesThrough UTMs and referring domainsDocumented
Session attribution explorerShows the session count for each combination of channel type, referrer and UTMDocumented
Referrer as a dashboard filterNot listed among the filters on the page we readOpen
Regex operatorNot mentioned on that pageUnverified

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.

  1. Start with the native channel type AI in the dashboard and the session attribution explorer.
  2. To cross-check, add a property filter on the referring domain and look for a regex operator in the menu.
  3. If your menu has no regex operator, run the HogQL form in a SQL insight instead.
  4. 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.