---
title: "Get filter dropdown contents for the visitors page. Returns the top values per dimension with distinct visitor counts so the UI can render \"Country — 1,234 visitors\" rows. Each dimension is computed against the segment minus its own filter, so a selected value never collapses its own dropdown."
method: GET
path: "/analytics/visitor-facets"
tags: ["Analytics"]
---

# Get filter dropdown contents for the visitors page. Returns the top values per dimension with distinct visitor counts so the UI can render "Country — 1,234 visitors" rows. Each dimension is computed against the segment minus its own filter, so a selected value never collapses its own dropdown.

`GET /analytics/visitor-facets`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/analytics/visitor-facets`
- Auth: HTTP bearer

## Query parameters

- `start_date` string, required
- `end_date` string, required
- `project_id` integer, required
- `environment_id` integer
- `include_crawlers` boolean
- `has_activity_only` boolean
- `per_facet_limit` integer
- `filter_country` string
- `filter_region` string
- `filter_city` string
- `filter_channel` string
- `filter_referrer` string
- `filter_user_id` string

## Response `200`

Top values per dimension

- VisitorFacets: All filter dropdown contents in one response. Each list is the top N values for that dimension within the current date range and segment (excluding the dimension being queried so the dropdown still shows alternatives when a value is already selected).
  - `channel` VisitorFacetValue[], required
    - `code` string, nullable: Optional secondary code for the value. Currently only populated for the `country` facet, where it carries the 2-letter ISO country code so the UI can render a flag without re-mapping.
    - `count` integer, required: Distinct visitor count matching this value in the current segment.
    - `value` string, required: The dimension value (e.g. "United States", "Chrome", "google.com"). `None` is encoded as the literal string "Direct" for referrer and as the empty string for the rest.
  - `city` VisitorFacetValue[], required
    - `code` string, nullable: Optional secondary code for the value. Currently only populated for the `country` facet, where it carries the 2-letter ISO country code so the UI can render a flag without re-mapping.
    - `count` integer, required: Distinct visitor count matching this value in the current segment.
    - `value` string, required: The dimension value (e.g. "United States", "Chrome", "google.com"). `None` is encoded as the literal string "Direct" for referrer and as the empty string for the rest.
  - `country` VisitorFacetValue[], required
    - `code` string, nullable: Optional secondary code for the value. Currently only populated for the `country` facet, where it carries the 2-letter ISO country code so the UI can render a flag without re-mapping.
    - `count` integer, required: Distinct visitor count matching this value in the current segment.
    - `value` string, required: The dimension value (e.g. "United States", "Chrome", "google.com"). `None` is encoded as the literal string "Direct" for referrer and as the empty string for the rest.
  - `referrer` VisitorFacetValue[], required
    - `code` string, nullable: Optional secondary code for the value. Currently only populated for the `country` facet, where it carries the 2-letter ISO country code so the UI can render a flag without re-mapping.
    - `count` integer, required: Distinct visitor count matching this value in the current segment.
    - `value` string, required: The dimension value (e.g. "United States", "Chrome", "google.com"). `None` is encoded as the literal string "Direct" for referrer and as the empty string for the rest.
  - `region` VisitorFacetValue[], required
    - `code` string, nullable: Optional secondary code for the value. Currently only populated for the `country` facet, where it carries the 2-letter ISO country code so the UI can render a flag without re-mapping.
    - `count` integer, required: Distinct visitor count matching this value in the current segment.
    - `value` string, required: The dimension value (e.g. "United States", "Chrome", "google.com"). `None` is encoded as the literal string "Direct" for referrer and as the empty string for the rest.

## Other responses

- `400`: Invalid date format or project not found
- `500`: Internal server error

## Changes

- **2026-11-21** `fada8eed0111`: 1 info
  - added the new optional `query` request parameter `filter_user_id`
- **2026-05-30** `b72341d12f63`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/analytics/visitor-facets/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
