Agent Wranglers

SEO-86Recommended

Count visits that come from AI assistants

Count visits from AI assistants as their own traffic source each month, by referrer host and by utm_source, per landing page. Report them next to search visits.

How to do it

People who click a link in an AI answer arrive with a referrer such as chatgpt.com, perplexity.ai, gemini.google.com or copilot.microsoft.com. Some links carry a utm_source that names the assistant instead. Keep the list of hosts in one file and add new assistants as they appear. Many visits lose their referrer, so read the count as a lower bound. Count without tracking people, as Count visits without tracking people says. Put the numbers beside impressions, as Measure impressions in AI answers says.

Examples

JavaScript example

const AI_ASSISTANT_HOSTS = ['chatgpt.com', 'perplexity.ai', 'gemini.google.com', 'copilot.microsoft.com'];

export function trafficSource({ referrer, utmSource }) {
  const host = referrer ? new URL(referrer).hostname.replace(/^www\./, '') : '';
  if (AI_ASSISTANT_HOSTS.includes(host) || AI_ASSISTANT_HOSTS.includes(utmSource)) return 'ai-assistant';
  return host.startsWith('google.') || host === 'bing.com' ? 'search' : 'other';
}

Python example

from urllib.parse import urlparse

AI_ASSISTANT_HOSTS = {"chatgpt.com", "perplexity.ai", "gemini.google.com", "copilot.microsoft.com"}

def traffic_source(referrer: str, utm_source: str = "") -> str:
    host = (urlparse(referrer).hostname or "").removeprefix("www.")
    if host in AI_ASSISTANT_HOSTS or utm_source in AI_ASSISTANT_HOSTS:
        return "ai-assistant"
    return "search" if host.startswith("google.") or host == "bing.com" else "other"

How to check

A unit test classifies sample visits with each listed referrer host as AI assistant traffic, and a visit from www.google.com as search. The monthly export has an AI assistant column for every landing page.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/seo/ai-search-answers/ai-referral-traffic">Agent Wranglers SEO playbook</a>. In code you write, add a comment next to it with the same link.