# Analytics

> How a site is doing: visits, pages, sources, devices, countries, leads, conversions, revenue, Google search, workflow runs and site health, each compared with the period before. 12 endpoints in the Unvop API.

How a site is doing: visits, pages, sources, devices, countries, leads, conversions, revenue, Google search, workflow runs and site health, each compared with the period before.

## How the site is doing

`GET /v1/sites/{siteId}/analytics/summary`

Scope: `analytics:read`.

The headline numbers for a period, each against the period before: visitors (daily visitors, summed) and sessions counted without cookies, bounce rate and average session length, page views, leads (form submissions), new contacts, conversion rate, payments and revenue, Google search clicks when Search Console is connected, and workflow runs. Plus `highlights`, plain sentences about what changed most, and the top pages, entry pages, lead pages, sources (with the leads each brought) and search queries. Start here for questions like "how is my site doing this month?" (period=this_month) and drill in with the other Analytics endpoints.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `metrics` (object, required)
  - `visitors` (object, required): Daily visitors, summed: unique visitors per UTC day, counted without cookies, added up over the period. One person who comes on three days counts three times.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `sessions` (object, required): Visits: a session ends after 30 minutes without activity.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `bounceRate` (object, required): The share of sessions that saw one page (0.42 is 42%).
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `avgSessionSeconds` (object, required): Average session length in seconds, from the first view to leaving the last page.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `viewsPerSession` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `returningVisitors` (object, required, nullable): Only with Returning visitors switched on: the visitors who accepted its cookie, each counted once over the period, split into new and returning. Null when none did.
    - `visitors` (number, required)
    - `new` (number, required)
    - `returning` (number, required)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `newContacts` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `highlights` (array of strings, required): What changed most, in sentences.
- `topPages` (array, required)
- `topLeadPages` (array, required)
- `topSources` (array, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/summary \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Traffic over time

`GET /v1/sites/{siteId}/analytics/traffic`

Scope: `analytics:read`.

Visitors, sessions, page views and leads per day, week or month, with totals (views per day, conversion rate, bounce rate, average session length) against the comparison period, and the busiest stretch. Visitors and sessions are counted without cookies by a hash that changes every day, so `visitors` over several days is daily visitors, summed, not distinct people. `returningVisitors` counts distinct people only for visitors who accepted the optional Returning visitors cookie.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `granularity` (string): How to group the series: day (default), week (from Monday) or month. One of `day`, `week`, `month`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `granularity` (string, required): One of `day`, `week`, `month`.
- `totals` (object, required)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `viewsPerDay` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `visitors` (object, required): Daily visitors, summed: unique visitors per UTC day, counted without cookies, added up over the period. One person who comes on three days counts three times.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `sessions` (object, required): Visits: a session ends after 30 minutes without activity.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `bounceRate` (object, required): The share of sessions that saw one page (0.42 is 42%).
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `avgSessionSeconds` (object, required): Average session length in seconds, from the first view to leaving the last page.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `viewsPerSession` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `returningVisitors` (object, required, nullable): Only with Returning visitors switched on: the visitors who accepted its cookie, each counted once over the period, split into new and returning. Null when none did.
    - `visitors` (number, required)
    - `new` (number, required)
    - `returning` (number, required)
- `series` (array of objects, required)
  - `start` (string, required)
  - `end` (string, required)
  - `views` (number, required)
  - `leads` (number, required)
  - `visitors` (number, required): Daily visitors, summed over the bucket.
  - `sessions` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/traffic \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Top pages

`GET /v1/sites/{siteId}/analytics/pages`

Scope: `analytics:read`.

Pages by views, leads or entries, each with its views, the leads sent from forms on it, its conversion rate, its entries (sessions that started on it) and their bounce rate, and the change against the comparison period. Sort by leads (sort=leads) to answer "which pages bring the most enquiries?" and by entries (sort=entries) for the pages people land on.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `limit` (integer): How many rows to return (default 20). (min 1; max 100)
- `sort` (string): Order by views (default), leads or entries. One of `views`, `leads`, `entries`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `sort` (string, required): One of `views`, `leads`, `entries`.
- `totals` (object, required)
  - `pages` (number, required)
  - `views` (number, required)
  - `leads` (number, required)
- `items` (array of objects, required)
  - `path` (string, required)
  - `title` (string, required, nullable)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (number, required)
  - `entries` (object, required): Sessions that started on this page.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `bounceRate` (number, required): The share of those sessions that saw no other page.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/pages \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Where visitors come from

`GET /v1/sites/{siteId}/analytics/sources`

Scope: `analytics:read`.

Referring sites (google.com, instagram.com, chatgpt.com…) with their views, the visitors and sessions that started from them, the leads sent in those visits, share and change, grouped into channels: direct, search, social, ai, email and referral. A lead’s source is the first referrer of the visit it was sent in; leads from before visitor counting started have none.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `limit` (integer): How many rows to return (default 20). (min 1; max 100)

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `totals` (object, required)
  - `views` (number, required)
  - `leadsWithSource` (number, required): Leads in the period with a known source.
- `channels` (array of objects, required)
  - `channel` (string, required)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `visitors` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `share` (number, required)
- `items` (array of objects, required)
  - `source` (string, required)
  - `channel` (string, required)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `visitors` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `sessions` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `share` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/sources \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Phones, tablets and computers

`GET /v1/sites/{siteId}/analytics/devices`

Scope: `analytics:read`.

Views and leads by device class (mobile, tablet, desktop), with share, conversion rate and change. Only the class is kept, never the browser details.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `items` (array of objects, required)
  - `key` (string, required)
  - `label` (string, required, nullable)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `share` (number, required)
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/devices \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Countries

`GET /v1/sites/{siteId}/analytics/countries`

Scope: `analytics:read`.

Views and leads by country (two-letter code and English name), with share, conversion rate and change.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `limit` (integer): How many rows to return (default 20). (min 1; max 100)

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `items` (array of objects, required)
  - `key` (string, required)
  - `label` (string, required, nullable)
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `share` (number, required)
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/countries \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Conversions

`GET /v1/sites/{siteId}/analytics/conversions`

Scope: `analytics:read`.

What visits turned into: form submissions (leads) by form, payments and revenue by currency, and the conversion rate (leads divided by page views), with a series and the change against the comparison period. Bookings made in an outside scheduler are not counted (`bookings` is null).

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `granularity` (string): How to group the series: day (default), week (from Monday) or month. One of `day`, `week`, `month`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `granularity` (string, required): One of `day`, `week`, `month`.
- `totals` (object, required)
  - `leads` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `payments` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `views` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `conversionRate` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `revenue` (array, required)
  - `bookings` (null, required)
- `forms` (array of objects, required)
  - `formId` (string, required)
  - `key` (string, required, nullable)
  - `name` (string, required)
  - `submissions` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `series` (array of objects, required)
  - `start` (string, required)
  - `end` (string, required)
  - `leads` (number, required)
  - `payments` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/conversions \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Leads by source and stage

`GET /v1/sites/{siteId}/analytics/leads`

Scope: `analytics:read`.

New contacts by where they came from (each form, payments, message channels, added by hand), the pipeline by stage (how many are in each now, how many new ones landed there, and how many moved into it in the period), and new contacts and leads over time, against the comparison period.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `granularity` (string): How to group the series: day (default), week (from Monday) or month. One of `day`, `week`, `month`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `granularity` (string, required): One of `day`, `week`, `month`.
- `totals` (object, required)
  - `newContacts` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `contactsNow` (number, required)
- `bySource` (array of objects, required)
  - `source` (string, required, nullable)
  - `label` (string, required)
  - `contacts` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `stages` (array of objects, required)
  - `stage` (string, required)
  - `label` (string, required)
  - `now` (number, required)
  - `newInPeriod` (number, required)
  - `movedIn` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `series` (array of objects, required)
  - `start` (string, required)
  - `end` (string, required)
  - `newContacts` (number, required)
  - `leads` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/leads \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Revenue

`GET /v1/sites/{siteId}/analytics/revenue`

Scope: `analytics:read`.

Revenue by currency (minor units, cents) and by plan, active subscriptions now, and revenue over time in the main currency, against the comparison period. Totals only; list single payments with GET /sites/{siteId}/payments.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `granularity` (string): How to group the series: day (default), week (from Monday) or month. One of `day`, `week`, `month`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `granularity` (string, required): One of `day`, `week`, `month`.
- `currencies` (array of objects, required)
  - `currency` (string, required)
  - `amount` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `payments` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `plans` (array of objects, required)
  - `plan` (string, required, nullable)
  - `mode` (string, required)
  - `currency` (string, required)
  - `amount` (number, required)
  - `payments` (number, required)
- `activeSubscriptions` (array of objects, required)
  - `currency` (string, required)
  - `count` (number, required)
  - `amount` (number, required)
- `series` (object, required)
  - `currency` (string, required, nullable)
  - `points` (array of objects, required)
    - `start` (string, required)
    - `end` (string, required)
    - `amount` (number, required)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/revenue \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Google search

`GET /v1/sites/{siteId}/analytics/search`

Scope: `analytics:read`.

Google Search Console for the site: clicks, impressions, click rate (ctr) and average position against the comparison period, a series, the top queries and pages with their change, and opportunities (queries close to page one, or on page one with few clicks). Needs Search Console connected under Growth; `connection` says whether it is and how recent the data is (Google reports about two days late).

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.
- `granularity` (string): How to group the series: day (default), week (from Monday) or month. One of `day`, `week`, `month`.
- `limit` (integer): How many queries, pages and opportunities to return (default 20). (min 1; max 100)

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `connection` (object, required)
  - `connected` (boolean, required)
  - `property` (string, required, nullable)
  - `lastSyncAt` (string, required, nullable)
  - `dataThrough` (string, required, nullable)
- `totals` (object, required)
  - `clicks` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `impressions` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `ctr` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `position` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
- `series` (array, required)
- `queries` (array, required)
- `pages` (array, required)
- `opportunities` (array of objects, required)
  - `query` (string, required)
  - `page` (string, required)
  - `clicks` (number, required)
  - `impressions` (number, required)
  - `ctr` (number, required)
  - `position` (number, required)
  - `reason` (string, required): One of `near-page-one`, `low-ctr`.

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/search \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Workflow runs

`GET /v1/sites/{siteId}/analytics/workflows`

Scope: `analytics:read`.

For each workflow: runs, successes, failures, failure rate, average run time and its latest failure, against the comparison period. Test runs are left out. Read single runs with GET /sites/{siteId}/workflows/{workflowId}/runs.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `totals` (object, required)
  - `workflows` (number, required)
  - `enabled` (number, required)
  - `runs` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `failed` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `failureRate` (number, required)
- `items` (array of objects, required)
  - `workflowId` (string, required)
  - `name` (string, required)
  - `runs` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `failed` (object, required): A number with its comparison.
    - `current` (number, required)
    - `previous` (number, required, nullable): The same measure in the comparison period; null with compare=none.
    - `change` (number, required, nullable): (current - previous) / previous: 0.25 is 25% up. Null when previous is 0 or missing.
  - `failureRate` (number, required)
  - `averageSeconds` (number, required, nullable)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/workflows \
  -H "Authorization: Bearer $UNVOP_KEY"
```

## Site health

`GET /v1/sites/{siteId}/analytics/health`

Scope: `analytics:read`.

What could hold the site back: published pages missing their Google title or description (or with ones too long or short, duplicated, or hidden from search), pages with no views in the period, Google index status when Search Console is connected, the latest PageSpeed score and the latest growth report with its open suggestions.

### Path parameters

- `siteId` (string, required): The site’s id.

### Query parameters

- `period` (string): A named period in the site’s time zone. 7d, 28d and the like end today; this_month runs from the 1st to today; last_month is the whole month before. Default 28d. Leave it out when you send from and to. One of `today`, `yesterday`, `7d`, `14d`, `28d`, `30d`, `90d`, `365d`, `this_week`, `last_week`, `this_month`, `last_month`, `this_quarter`, `last_quarter`, `this_year`, `last_year`.
- `from` (string): The first day, YYYY-MM-DD, in the site’s time zone. Use with to for any range up to 800 days.
- `to` (string): The last day, YYYY-MM-DD, included. Default today.
- `compare` (string): What to compare with: previous (default: the period before; a whole month against the whole month before), year (the same dates a year earlier) or none. One of `previous`, `year`, `none`.

### Response 200

- `period` (object, required)
  - `preset` (string, required): The named period, or custom for from and to.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
  - `timeZone` (string, required): The time zone the days are in.
  - `timeZoneSource` (string, required): site: the site’s own time zone. default: none is set, so UTC. One of `site`, `default`.
- `previous` (object, required, nullable): The comparison period, or null with compare=none.
  - `from` (string, required)
  - `to` (string, required)
  - `days` (integer, required)
- `notes` (array of strings, required): What the numbers do and don’t include. Worth passing on.
- `seo` (object, required)
  - `publishedPages` (number, required)
  - `missingSeoTitle` (number, required)
  - `missingDescription` (number, required)
  - `noindex` (number, required)
  - `duplicateTitles` (number, required)
  - `pagesWithIssues` (number, required)
- `pagesWithoutViews` (array of strings, required)
- `pages` (array of objects, required)
  - `path` (string, required)
  - `kind` (string, required)
  - `title` (string, required)
  - `seoTitle` (string, required, nullable)
  - `description` (string, required, nullable)
  - `views` (number, required)
  - `issues` (array of strings, required)
- `index` (object, required, nullable)
  - `checked` (number, required)
  - `indexed` (number, required)
  - `notIndexed` (array, required)
- `pagespeed` (any, required, nullable)
- `growthReport` (any, required, nullable)

### Errors

- `401`: No key, or the key isn’t valid.
- `403`: The key lacks the scope (insufficient_scope) or the role this needs, or the site’s plan lacks the feature (feature_not_in_plan).
- `404`: Not found, or not reachable with this key.
- `422`: The body is invalid; details say which values.
- `429`: Too many requests; wait for RateLimit-Reset seconds.

### Example

```sh
curl https://api.unvop.com/v1/sites/site_123/analytics/health \
  -H "Authorization: Bearer $UNVOP_KEY"
```
