AI Traffic (GA4)Get By Llm Source

GA4 by LLM

AI-referred site traffic broken out per LLM source — sessions, users, and pageviews for each assistant — plus the previous period.

curl --request GET \
  --url 'https://api.aiclicks.io/api/v1/ga4/by-llm?domain_id=8f1d3c0a-2f9b-4c11-9b80-7a82e1f0c3f3&days=30' \
  --header 'Authorization: Bearer ak_live_xxx'
{
  "data": {
    "by_llm": {
      "chatgpt": { "sessions": 720, "users": 560, "pageviews": 1800 },
      "perplexity": { "sessions": 300, "users": 250, "pageviews": 760 },
      "claude": { "sessions": 220, "users": 170, "pageviews": 550 }
    },
    "previous_by_llm": {
      "chatgpt": { "sessions": 610, "users": 500, "pageviews": 1600 },
      "perplexity": { "sessions": 250, "users": 210, "pageviews": 640 }
    }
  },
  "domain_id": "8f1d3c0a-2f9b-4c11-9b80-7a82e1f0c3f3",
  "days": 30,
  "llm_source": null,
  "generated_at": "2026-07-13T10:00:11.218Z"
}

The same AI-referred traffic as GA4 summary, split by the AI assistant that referred it — ChatGPT vs Perplexity vs Claude vs Gemini vs Copilot, and so on. Use it to see which assistants actually drive visitors to the site, not just which ones mention the brand.

by_llm is keyed by the normalized source name; each value carries sessions, users, and pageviews. previous_by_llm is the same map for the immediately preceding window of equal length.

domain_id is a required query parameter. Use GET /api/v1/domains to discover which domains the calling key can access. When the domain has no connected GA4 property (or no AI-referred traffic in the window), both maps come back empty ({}) with a 200.

Authorizations

header
Authorizationstring
Required

Your API key formatted as Bearer ak_live_<your-key>. Create one in the dashboard under Settings → Developers.

header
X-Request-Idstring

Optional UUID for log correlation. If omitted, we generate one and echo it back in the response.

Query parameters

query
domain_idstring
Required

UUID of the domain. Find domains via GET /api/v1/domains. Omitting this returns 400.

query
daysinteger

Trailing look-back window, 1–365. Defaults to 30. previous_by_llm covers the window of equal length immediately before it.

query
llm_sourcestring

Optional. Restrict to a single AI/LLM referral source — chatgpt, perplexity, claude, gemini, copilot, you, deepseek, grok, … With a filter set, the maps contain at most that one key. Omit for all sources.

Response

dataobject
Required

The per-source payload.

by_llmobject
Required

Map keyed by normalized LLM source name (chatgpt, perplexity, claude, gemini, copilot, other_llm, …). Each value is { sessions, users, pageviews }. Empty {} when there is no data.

previous_by_llmobject
Required

The same map for the immediately preceding window of equal length. A source present in one map but not the other simply had no traffic that period.

domain_idstring
Required

Echo of the requested domain.

daysinteger
Required

Echo of the requested window.

llm_sourcestring

Echo of the requested llm_source filter, or null when unset.

generated_atstring
Required

ISO-8601 timestamp of when the server produced (or cached) this response.

Response headers

HeaderDescription
X-CacheHIT or MISS. Whether the response came from cache.
X-Request-IdUnique request id. Echoes incoming if you set one.
X-RateLimit-LimitMax requests per minute for this key.
X-RateLimit-RemainingRequests remaining in the current minute.
X-RateLimit-ResetUnix epoch seconds when the window resets.

Caching

Cached for a short window per (domain_id, days, llm_source). Freshly synced GA4 data appears after the TTL expires.

Empty result

{
  "data": { "by_llm": {}, "previous_by_llm": {} },
  "domain_id": "8f1d3c0a-2f9b-4c11-9b80-7a82e1f0c3f3",
  "days": 30,
  "llm_source": null,
  "generated_at": "2026-07-13T10:00:11.218Z"
}