# Get site analytics breakdown

Read a website's traffic grouped by page, source, campaign, country, device or another supported dimension for the selected dates.

POST https://api.brigg.app/v1/operations/analytics.GetSiteAnalyticsBreakdown

## Access & visibility

Allow `analytics.GetSiteAnalyticsBreakdown` on your API key.

**Workspace access by default.** Private member data requires [approved member delegation](https://developer.brigg.app/authentication#member-delegation) through `Brigg-Act-As`; the key supplies permissions while private ownership and project boundaries remain enforced.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bundle_id` | string | Yes | Select a website and use its content_id. This is the website identity, not a domain hostname or workspace ID. [workspace.ListBundles](https://developer.brigg.app/reference/workspace/ListBundles). At least 1 character. |
| `dimension` | string | Yes | Dimension used to group the traffic results. Allowed: `"page"`, `"entry_page"`, `"source"`, `"referrer"`, `"campaign"`, `"country"`, `"device"`, `"browser"`, `"os"`. |
| `from` | integer | No | First UTC day, inclusive: floor(unixMilliseconds / 86400000). Defaults to 29 days before to. It is not a timestamp or date string. |
| `to` | integer | No | Last UTC day, inclusive, as days since 1970-01-01. Defaults to today. If from is after to it becomes to; a difference above 366 is reduced to 366. Read the effective bounds in the response. |
| `limit` | integer | No | Number of results to request per page. Range: 1 to 100. |

## Choose and interpret a reporting interval

`from` and `to` are inclusive **UTC day indexes**, not dates or Unix milliseconds. For example, 1 October 2026 is `20727`. In JavaScript use `Math.floor(Date.parse("2026-10-01T00:00:00Z") / 86400000)`. Omitted `to` means today; omitted `from` means 29 days before `to`. The service clamps a span longer than 366 days. Read the response's `from` and `to` to see the interval actually used.

`bounceRate` is a fraction, so `0.2` means 20%. Fields ending in `Ms` are durations in milliseconds. Summary visitors is the sum of daily visitor counts, not a deduplicated count of people across the interval. The same visitor can count on several days; workspace totals also sum across sites.

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bundle_id` | string | Yes | Bundle identifier. |
| `dimension` | string | Yes | Dimension used to group the traffic results. |
| `from` | number | Yes | First UTC day in the reporting interval, inclusive. A day index counts days since 1970-01-01; multiply by 86400000 to obtain Unix milliseconds. |
| `to` | number | Yes | Last UTC day in the reporting interval, inclusive, as a day index since 1970-01-01. |
| `rows` | array of [object](#response-rows) | Yes | Traffic measurements grouped by the requested dimension. |

### response.rows[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `value` | string | Yes | Value of the grouping dimension for this row. |
| `pageviews` | number | Yes | Pageviews for this dimension value, except entry_page where it counts session landings. |
| `visitors` | number | Yes | Sum of daily distinct visitors per site. A person returning on another day or site can be counted again; this is not a deduplicated multi-day audience. |
| `avg_engagement_ms` | number | Yes | Avg engagement ms, in milliseconds. |

## Errors & retries

This operation reads data. It needs no idempotency key and can be retried after a transient failure.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |

## Next steps

- [Get site analytics summary](https://developer.brigg.app/reference/analytics/GetSiteAnalyticsSummary)
- [Get site analytics realtime](https://developer.brigg.app/reference/analytics/GetSiteAnalyticsRealtime)
- [List bundles](https://developer.brigg.app/reference/workspace/ListBundles)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Example request

Fictional values. Replace IDs and business details with values from your workspace.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/analytics.GetSiteAnalyticsBreakdown' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "bundle_id": "e_example",
  "dimension": "page"
}'
```

#### TypeScript


```typescript
const response = await fetch("https://api.brigg.app/v1/operations/analytics.GetSiteAnalyticsBreakdown", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "bundle_id": "e_example",
    "dimension": "page"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "bundle_id": "e_example",
  "dimension": "page"
}
request = Request(
    "https://api.brigg.app/v1/operations/analytics.GetSiteAnalyticsBreakdown",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "bundle_id": "e_example",
  "dimension": "page",
  "from": 20727,
  "to": 20728,
  "rows": [
    {
      "value": "/pricing",
      "pageviews": 55,
      "visitors": 32,
      "avg_engagement_ms": 1
    }
  ]
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "bundle_id": {
      "type": "string",
      "minLength": 1,
      "description": "Select a website and use its content_id. This is the website identity, not a domain hostname or workspace ID. [workspace.ListBundles](https://developer.brigg.app/reference/workspace/ListBundles)."
    },
    "dimension": {
      "type": "string",
      "enum": [
        "page",
        "entry_page",
        "source",
        "referrer",
        "campaign",
        "country",
        "device",
        "browser",
        "os"
      ],
      "description": "Dimension used to group the traffic results."
    },
    "from": {
      "type": "integer",
      "description": "First UTC day, inclusive: floor(unixMilliseconds / 86400000). Defaults to 29 days before to. It is not a timestamp or date string."
    },
    "to": {
      "type": "integer",
      "description": "Last UTC day, inclusive, as days since 1970-01-01. Defaults to today. If from is after to it becomes to; a difference above 366 is reduced to 366. Read the effective bounds in the response."
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Number of results to request per page."
    }
  },
  "required": [
    "bundle_id",
    "dimension"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "bundle_id": "e_example",
      "dimension": "page"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "bundle_id": {
      "type": "string",
      "description": "Bundle identifier."
    },
    "dimension": {
      "type": "string",
      "description": "Dimension used to group the traffic results."
    },
    "from": {
      "type": "number",
      "description": "First UTC day in the reporting interval, inclusive. A day index counts days since 1970-01-01; multiply by 86400000 to obtain Unix milliseconds."
    },
    "to": {
      "type": "number",
      "description": "Last UTC day in the reporting interval, inclusive, as a day index since 1970-01-01."
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "description": "Value of the grouping dimension for this row."
          },
          "pageviews": {
            "type": "number",
            "description": "Pageviews for this dimension value, except entry_page where it counts session landings."
          },
          "visitors": {
            "type": "number",
            "description": "Sum of daily distinct visitors per site. A person returning on another day or site can be counted again; this is not a deduplicated multi-day audience."
          },
          "avg_engagement_ms": {
            "type": "number",
            "description": "Avg engagement ms, in milliseconds."
          }
        },
        "required": [
          "value",
          "pageviews",
          "visitors",
          "avg_engagement_ms"
        ],
        "additionalProperties": false
      },
      "description": "Traffic measurements grouped by the requested dimension."
    }
  },
  "required": [
    "bundle_id",
    "dimension",
    "from",
    "to",
    "rows"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "bundle_id": "e_example",
      "dimension": "page",
      "from": 20727,
      "to": 20728,
      "rows": [
        {
          "value": "/pricing",
          "pageviews": 55,
          "visitors": 32,
          "avg_engagement_ms": 1
        }
      ]
    }
  ]
}
```

