{"slug": "how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from", "title": "How many visitors do ChatGPT and Perplexity actually send you? Count them from your access logs", "summary": "A developer at Get AI Vizible published a Python script that counts visits sent to a site by AI assistants such as ChatGPT, Perplexity, Gemini, Copilot, Claude, DeepSeek and Grok, using only the standard library and Apache/Nginx combined access logs. The script matches the Referer header against known assistant hosts and also catches ChatGPT's utm_source=chatgpt.com tag, which it says is often the only trace left when mobile apps strip the referrer, then reports per-assistant totals and top landing pages. On a small test log it attributed 6 of 8 successful page views to an AI assistant.", "body_md": "*Disclosure: I work on [Get AI Vizible](https://getvizible.online), which tracks how AI assistants mention brands. Nothing below needs it: just a log file and the Python standard library. This post was drafted by an AI agent for our team; the script was run against a test log before publishing.*\n\nEveryone is talking about \"AI search traffic\", but most analytics dashboards lump it into \"referral\" or \"direct\". If you have server access logs, you can get a real number in a few minutes, and see which pages the assistants are sending people to.\n\nWhen someone clicks a link inside an AI assistant's answer, the visit usually carries the assistant's domain in the `Referer` header:\n\n| Assistant | Referrer host | \n|---|---|\n| ChatGPT | `chatgpt.com` (older links:`chat.openai.com` ) | \n| Perplexity | `perplexity.ai` /`www.perplexity.ai` | \n| Gemini | `gemini.google.com` | \n| Microsoft Copilot | `copilot.microsoft.com` | \n| Claude | `claude.ai` | \n| DeepSeek | `chat.deepseek.com` | \n| Grok | `grok.com` | \n\nChatGPT also appends `utm_source=chatgpt.com` to the links it shows. That matters, because the mobile apps often strip the referrer: the UTM tag is then the only trace left in the request.\n\nIt reads the standard Apache/Nginx \"combined\" format, keeps successful `GET` requests, and counts the ones that came from an assistant, with the top landing pages for each:\n\n``` bash\n#!/usr/bin/env python3\n\"\"\"Count visits that AI assistants send to your site, from an access log.\n\nUsage: python ai_referrals.py access.log [access.log.1 ...]\nReads Apache/Nginx \"combined\" format. Standard library only.\n\"\"\"\nimport re\nimport sys\nfrom collections import Counter, defaultdict\nfrom urllib.parse import urlsplit, parse_qs\n\n# Referrer host -> assistant. Subdomains match too (www.perplexity.ai).\nAI_HOSTS = {\n    \"chatgpt.com\": \"ChatGPT\",\n    \"chat.openai.com\": \"ChatGPT\",\n    \"perplexity.ai\": \"Perplexity\",\n    \"gemini.google.com\": \"Gemini\",\n    \"copilot.microsoft.com\": \"Copilot\",\n    \"claude.ai\": \"Claude\",\n    \"chat.deepseek.com\": \"DeepSeek\",\n    \"grok.com\": \"Grok\",\n}\n# ChatGPT adds utm_source=chatgpt.com to links it shows; this catches visits\n# whose referrer was stripped (common from the mobile apps).\nAI_UTM = {\"chatgpt.com\": \"ChatGPT\"}\n\nLINE = re.compile(\n    r'(?P<ip>\\S+) \\S+ \\S+ \\[(?P<time>[^\\]]+)\\] \"(?P<method>\\S+) (?P<path>\\S+) [^\"]*\" '\n    r'(?P<status>\\d{3}) \\S+ \"(?P<ref>[^\"]*)\" \"(?P<ua>[^\"]*)\"'\n)\n\ndef assistant_for(ref, path):\n    host = (urlsplit(ref).hostname or \"\") if ref not in (\"\", \"-\") else \"\"\n    for known, name in AI_HOSTS.items():\n        if host == known or host.endswith(\".\" + known):\n            return name\n    source = parse_qs(urlsplit(path).query).get(\"utm_source\", [\"\"])[0].lower()\n    return AI_UTM.get(source)\n\ndef main(files):\n    by_ai, pages = Counter(), defaultdict(Counter)\n    total = 0\n    for name in files:\n        with open(name, encoding=\"utf-8\", errors=\"replace\") as fh:\n            for line in fh:\n                m = LINE.match(line)\n                if not m or m[\"method\"] != \"GET\" or not m[\"status\"].startswith(\"2\"):\n                    continue\n                total += 1\n                ai = assistant_for(m[\"ref\"], m[\"path\"])\n                if ai:\n                    by_ai[ai] += 1\n                    pages[ai][urlsplit(m[\"path\"]).path] += 1\n    found = sum(by_ai.values())\n    print(f\"{found} of {total} successful page views came from an AI assistant\")\n    for ai, n in by_ai.most_common():\n        top = \", \".join(f\"{p} ({c})\" for p, c in pages[ai].most_common(3))\n        print(f\"  {ai:<11}{n:>6}   top pages: {top}\")\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        sys.exit(__doc__)\n    main(sys.argv[1:])\n```\n\nRun it on today's log, or on a week of rotated logs at once:\n\n```\npython ai_referrals.py /var/log/nginx/access.log /var/log/nginx/access.log.1\n```\n\nOn a small test log it prints:\n\n```\n6 of 8 successful page views came from an AI assistant\n  ChatGPT         3   top pages: /pricing (2), /blog/llms-txt (1)\n  Perplexity      1   top pages: /blog/llms-txt (1)\n  Gemini          1   top pages: / (1)\n  Claude          1   top pages: /pricing (1)\n```\n\nA few details worth noting:\n\n`www.perplexity.ai` counts but a look-alike such as `notchatgpt.com` doesn't.`2xx` `GET` requests are counted, so 404s, redirects and form posts don't inflate the number.\nTreat the result as a floor, not the full picture:\n\n`Referrer-Policy` settings drop the header. Apart from ChatGPT's UTM tag, those visits land in \"direct\".`google.com`, exactly like a normal search click. Search Console is the only place Google reports it.\nEven with those gaps, the landing-page list is useful. The pages assistants link to are the ones they consider the best answer, which tells you what to keep accurate and up to date.\n\n`robots.txt`.\nIf you run this on your own logs, I'm curious which assistant comes out on top for you. Let me know in the comments.", "url": "https://wpnews.pro/news/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from", "canonical_source": "https://dev.to/getvizibleonline/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from-your-access-logs-3hmb", "published_at": "2026-12-02 15:41:15+00:00", "updated_at": "2026-12-02 15:45:38.724270+00:00", "lang": "en", "topics": ["ai-search", "ai-crawlers", "generative-engine-optimization", "ai-tools"], "entities": ["ChatGPT", "Perplexity", "Gemini", "Microsoft Copilot", "Claude", "DeepSeek", "Grok", "Get AI Vizible"], "also_reported_by": [], "takeaway": "Parse the Referer header against assistant hosts like chatgpt.com and perplexity.ai, and also check for utm_source=chatgpt.com, since mobile apps strip the referrer and the UTM tag is the only remaining trace.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from", "markdown": "https://wpnews.pro/news/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from.md", "text": "https://wpnews.pro/news/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from.txt", "jsonld": "https://wpnews.pro/news/how-many-visitors-do-chatgpt-and-perplexity-actually-send-you-count-them-from.jsonld"}}