Get Visitor Locations
get_visitor_locationsWhere your site's visitors were over a period, by country, from your PostHog project: the Performance page's Visitors tab. A visitor is a PostHog person; countries are every located country, most visitors first, each with its ISO alpha-2 code, name, visitors and pageviews. unknown counts visitors PostHog couldn't place (GeoIP off, a reverse proxy that hides visitor IPs, or cookieless mode, where PostHog drops the IP); unknown.cookieless is how many of them came in cookieless mode. total sums the rows, so someone seen in two countries counts twice. state is ready, no-posthog (not connected), no-signal (PostHog has received no events yet) or failed, with reason: busy means PostHog didn't answer in time (it runs 3 queries at once per project and queues the rest), so try again in a minute; the PostHog connection is fine. error is any other failure, such as lost access, so check the PostHog connection. source ai_referral keeps only visits opened from an AI assistant's answer (ChatGPT, Perplexity, Claude, Gemini, Copilot and others), matched by referring domain or utm_source: the AI referrals card on the AI assistants tab. It is a floor: assistant clicks that arrive with no referrer and no utm_source can't be counted. Rank AI referrals by visitors, not pageviews: on a single-page site every pageview of the visit keeps the AI referrer, on a multi-page site only the first does. Does not change anything. Related: get_ai_visibility, get_content_performance, get_setup_status.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_visitor_locations"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Range end YYYY-MM-DD. | |
| from | No | Range start YYYY-MM-DD. Defaults to the last 28 settled days. | |
| source | No | all (default): every visit. ai_referral: only visits from an AI assistant's answer. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| from | Yes | ||
| appUrl | Yes | ||
| visitors | Yes |