Skip to main content
Use this endpoint to pull the headline numbers shown on the Betterumami Overview screen: pageviews, unique visitors, visits, bounces, and total time on site. Supply a date range using Unix millisecond timestamps (startAt/endAt) or ISO 8601 strings (startDate/endDate). Add the compare parameter to get a parallel set of numbers for the previous period or the same period last year, making it easy to calculate percentage changes in your own dashboards. GET /api/websites/{websiteId}/stats

Request

Headers

string
required
Bearer token. Pass your API key: Authorization: Bearer <api-key>

Path Parameters

string
required
The unique UUID of the website to query.

Query Parameters

Date Range

number
Start of the date range as a Unix timestamp in milliseconds. Use this or startDate.
number
End of the date range as a Unix timestamp in milliseconds. Use this or endDate.
string
Start of the date range as an ISO 8601 date or datetime, e.g. 2024-01-01 or 2024-01-01T00:00:00Z. Use this or startAt.
string
End of the date range as an ISO 8601 date or datetime. Use this or endAt.
string
IANA time zone used to interpret dates, e.g. America/New_York. Defaults to UTC.
string
Time interval used to group results when computing statistics: minute, hour, day, month, or year.
string
Include a comparison period in the response. prev compares against the immediately preceding period of the same length; yoy compares against the same period one year ago.

Filters

string
Filter results to a specific URL path, e.g. /blog/my-post.
string
Filter by referring URL.
string
Filter by page title.
string
Filter by URL query string.
string
Filter by visitor operating system, e.g. Windows, macOS.
string
Filter by visitor browser, e.g. Chrome, Firefox.
string
Filter by device category: desktop, mobile, or tablet.
string
Filter by ISO 3166-1 alpha-2 country code, e.g. US, DE.
string
Filter by region or subdivision of the visitor.
string
Filter by visitor city.
string
Filter by the browser’s preferred language, e.g. en-US.
string
Filter by custom event name.
string
Filter by UTM campaign source.
string
Filter by UTM campaign medium.
string
Filter by UTM campaign name.
string
Filter by UTM campaign content.
string
Filter by UTM campaign search term.
string
Filter by a tag attached to tracked activity.
string
Filter by the hostname on which the activity occurred.
string
Filter by a custom identifier assigned to the visitor.
integer
Filter by event type: 1 for pageviews, 2 for custom events.
string
Set to any non-empty value to exclude single-pageview visits from the results.
string
UUID of a saved segment to apply as a filter.
string
UUID of a saved cohort to filter visitors by.
string
Controls how multiple filters combine. all requires every filter to match (AND logic); any requires at least one to match (OR logic). Defaults to all.

Response

200 – Success
number
required
Total number of pageviews in the selected period.
number
required
Number of unique visitors in the selected period.
number
required
Total number of visits (sessions) in the selected period.
number
required
Number of visits where the visitor viewed only one page.
number
required
Aggregate time visitors spent on the site, in seconds.
object
required
Present when compare is supplied. Contains the same five metrics for the comparison period.
number
Pageviews during the comparison period.
number
Unique visitors during the comparison period.
number
Visits during the comparison period.
number
Bounces during the comparison period.
number
Total time on site during the comparison period, in seconds.
200 Response

Code Sample