Website statistics
Operations around Website statistics.
Endpoints
GET /api/websites/:websiteId/active
GET /api/websites/:websiteId/events
GET /api/websites/:websiteId/pageviews
GET /api/websites/:websiteId/metrics
GET /api/websites/:websiteId/stats
Unit Parameter
The unit parameter buckets the data returned. The unit is automatically converted to the next largest applicable time unit if the maximum is exceeded.
minute
: Up to 60 minutes.hour
: Up to 48 hours.day
: Up to 12 months.month
: No limit.year
: No limit.
GET /api/websites/:websiteId/active
Gets the number of active users on a website.
Parameters
None
Sample response
GET from url: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/active
{
"x": 5
}
x
: Number of unique visitors within the last 5 minutes
GET /api/websites/:websiteId/events/series
Gets events within a given time range.
Parameters
startAt
: Timestamp (in ms) of starting date.endAt
: Timestamp (in ms) of end date.unit
: Time unit (year | month | hour | day).timezone
: Timezone (ex. America/Los_Angeles).url
: (optional) Name of URL.referrer
: (optional) Name of referrer.title
: (optional) Name of page title.host
: (optional) Name of hostname.os
: (optional) Name of operating system.browser
: (optional) Name of browser.device
: (optional) Name of device (ex. Mobile)country
: (optional) Name of country.region
: (optional) Name of region/state/province.city
: (optional) Name of city.
Sample response
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/events/series?startAt=1683262800000&endAt=1683349199999&unit=hour&timezone=America%2FLos_Angeles
[
{ "x": "live-demo-button", "t": "2023-04-12T22:00:00Z", "y": 1 },
{ "x": "get-started-button", "t": "2023-04-12T22:00:00Z", "y": 5 },
{ "x": "get-started-button", "t": "2023-04-12T23:00:00Z", "y": 4 },
{ "x": "live-demo-button", "t": "2023-04-12T23:00:00Z", "y": 4 },
{ "x": "social-Discord", "t": "2023-04-13T00:00:00Z", "y": 1 }
]
x
: Event name.t
: Timestamp.y
: Number of events.
GET /api/websites/:websiteId/pageviews
Gets pageviews within a given time range.
Parameters
startAt
: Timestamp (in ms) of starting date.endAt
: Timestamp (in ms) of end date.unit
: Time unit (year | month | hour | day).timezone
: Timezone (ex. America/Los_Angeles).url
: (optional) Name of URL.referrer
: (optional) Name of referrer.title
: (optional) Name of page title.host
: (optional) Name of hostname.os
: (optional) Name of operating system.browser
: (optional) Name of browser.device
: (optional) Name of device (ex. Mobile)country
: (optional) Name of country.region
: (optional) Name of region/state/province.city
: (optional) Name of city.
Sample response
{
"pageviews": [
{ "x": "2020-04-20 01:00:00", "y": 3 },
{ "x": "2020-04-20 02:00:00", "y": 7 }
],
"sessions": [
{ "x": "2020-04-20 01:00:00", "y": 2 },
{ "x": "2020-04-20 02:00:00", "y": 4 }
]
}
x
: Timestamp.y
: Number of visitors.
GET /api/websites/:websiteId/stats
Gets summarized website statistics.
Parameters
startAt
: Timestamp (in ms) of starting date.endAt
: Timestamp (in ms) of end date.url
: (optional) Name of URL.referrer
: (optional) Name of referrer.title
: (optional) Name of page title.query
: (optional) Name of query.event
: (optional) Name of event.host
: (optional) Name of hostname.os
: (optional) Name of operating system.browser
: (optional) Name of browser.device
: (optional) Name of device (ex. Mobile)country
: (optional) Name of country.region
: (optional) Name of region/state/province.city
: (optional) Name of city.
Sample response
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/stats?startAt=1656679719687&endAt=1656766119687
{
"pageviews": { "value": 3018, "prev": 3508 },
"visitors": { "value": 847, "prev": 910 },
"visits": { "value": 984, "prev": 1080 },
"bounces": { "value": 537, "prev": 628 },
"totaltime": { "value": 150492, "prev": 164713 }
}
pageviews
: Pages hitsvisitors
: Number of unique visitorsvisits
: Number of sessionsbounces
: Number of visitors who only visit a single pagetotaltime
: Time spent on the website
GET /api/websites/:websiteId/metrics
Gets metrics for a given time range.
Parameters
startAt
: Timestamp (in ms) of starting date.endAt
: Timestamp (in ms) of end date.type
: Metrics type (url | referrer | browser | os | device | country | event).url
: (optional) Name of URL.referrer
: (optional) Name of referrer.title
: (optional) Name of page title.query
: (optional) Name of query.host
: (optional) Name of hostname.os
: (optional) Name of operating system.browser
: (optional) Name of browser.device
: (optional) Name of device (ex. Mobile)country
: (optional) Name of country.region
: (optional) Name of region/state/province.city
: (optional) Name of city.language
: (optional) Name of language.event
: (optional) Name of event.limit
: (optional, default 500) Number of events returned.
Sample response
[
{ "x": "/", "y": 46 },
{ "x": "/docs", "y": 17 },
{ "x": "/download", "y": 14 }
]
x
: Unique value, depending on metric type (url | referrer | browser | os | device | country | event).y
: Number of visitors.