---
title: "Visitor analytics of a project: pageviews, unique visitors, top pages, referrers, countries, devices and browsers"
method: GET
path: "/projects/{projectId}/analytics"
tags: ["Analytics"]
---

# Visitor analytics of a project: pageviews, unique visitors, top pages, referrers, countries, devices and browsers

`GET /projects/{projectId}/analytics`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/projects/{projectId}/analytics`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

Cookieless and server-side: counted from the platform proxy's access log for the project's platform hostname and verified custom domains, without any script in the site. Bots, assets and non-page responses are left out; unique visitors are a daily salted hash of address and browser (never stored as such). range=24h gives hourly buckets of the rolling 24 hours, 7d and 30d daily UTC buckets. `collector.active` is false until the platform operator has switched the proxy's access log on.

## Path parameters

- `projectId` string, uuid, required

## Query parameters

- `range` '24h' | '7d' | '30d'

## Response `200`

Analytics

- object
  - `projectId` string, uuid, required
  - `range` '24h' | '7d' | '30d', required
  - `granularity` 'hour' | 'day', required
  - `from` string, required: Start of the first bucket (inclusive)
  - `to` string, required: End of the window (now)
  - `collector` object, required
    - `active` boolean, required: The access-log collector reported within the last 15 minutes (analytics is switched on)
    - `lastSeenAt` string, nullable, required: ISO-8601 timestamp
    - `countries` boolean, required: The collector resolves countries (its IP-to-country database is present)
  - `totals` object, required
    - `pageviews` integer, required
    - `visitors` integer, required: 24h: unique visitors in the rolling 24 hours; 7d/30d: the sum of each day's unique visitors
  - `series` object[], required: Every bucket of the window, zero-filled, oldest first
    - `start` string, required: Start of the hour (range 24h) or UTC day (7d/30d)
    - `pageviews` integer, required
    - `visitors` integer, required: Unique visitors in this hour or day
  - `pages` object, required
    - `metric` 'pageviews' | 'visitors', required
    - `items` object[], required: At most 10, largest first
      - `value` string, required: Path, referrer host, ISO country code, device class or browser family; "(other)" collects values past the cap
      - `count` integer, required
  - `referrers` object, required
    - `metric` 'pageviews' | 'visitors', required
    - `items` object[], required: At most 10, largest first
      - `value` string, required: Path, referrer host, ISO country code, device class or browser family; "(other)" collects values past the cap
      - `count` integer, required
  - `countries` object, required
    - `metric` 'pageviews' | 'visitors', required
    - `items` object[], required: At most 10, largest first
      - `value` string, required: Path, referrer host, ISO country code, device class or browser family; "(other)" collects values past the cap
      - `count` integer, required
  - `devices` object, required
    - `metric` 'pageviews' | 'visitors', required
    - `items` object[], required: At most 10, largest first
      - `value` string, required: Path, referrer host, ISO country code, device class or browser family; "(other)" collects values past the cap
      - `count` integer, required
  - `browsers` object, required
    - `metric` 'pageviews' | 'visitors', required
    - `items` object[], required: At most 10, largest first
      - `value` string, required: Path, referrer host, ISO country code, device class or browser family; "(other)" collects values past the cap
      - `count` integer, required

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `429`: Too many requests (code rate_limited); see Retry-After
- `501`: Visitor analytics is not available on this server yet (code not_configured)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
