Set up analytics for visits from AI assistants.
Prints, without touching the network, what you paste into your analytics: a regular expression for your own AI channel group in GA4 (valid RE2, dots escaped; put the channel above Referral, because GA4 assigns a session to the first channel that matches, and the built-in AI Assistant channel added on 2026-05-13 leaves out Perplexity), a Yandex Metrica segment condition on the referrer (Metrica has no AI source of its own and Alice sets no UTM tags; the same expression goes into the API filters parameter), and an optional "How did you hear about us?" form field with ChatGPT, Perplexity, Google AI, Alice, Claude and other — the only way to count clicks from the ChatGPT app, which arrive with no referrer and land in Direct or Unassigned. The assistant domains live in indexgap/data/ai_referrers.json with their date. check --forms finds lead forms without that field; doctor --logs counts people who came from an assistant, by referrer or utm_source, next to the AI bots — a lower bound, since referrer-less clicks are invisible there too. --out writes the same text, or JSON for a .json name.
usage: indexgap analytics [-h] [--ga4] [--metrika] [--form]
[--form-lang {en,ru}] [--out OUT]
[experimental] analytics setup for visits from AI assistants: GA4, Yandex
Metrica, a form field. No network
options:
-h, --help show this help message and exit
--ga4 the regular expression for your own “AI” channel group
in GA4
--metrika the Yandex Metrica segment condition on the referrer
--form the HTML of a “How did you hear about us?” field
--form-lang {en,ru} language of the form field; the output language by
default
--out OUT also write to a file: .json for data, anything else for
Markdown text