umami
Product
DocsDevelopersPricing
16.8kLog inSign up
General
About
FAQ
Useful links
Getting started
Getting started
Install
Login
Add a website
Collect data
Basics
Add a user
Enable share URL
Track events
Teams
Updates
Languages
Advanced
Tracker configuration
Tracker functions
Environment variables
Reference
API
Authentication
Users
Teams
Websites
Website stats
Sending stats
Event Data
API Client
Cloud
Overview
API key
Import data
Guides
Migrating v1 to v2
Hosting
Running on DigitalOcean
Running on Vercel
Running on Neon Postgres
Running on Netlify
Running on Heroku
Running on Railway
Running on Supabase
Running on PlanetScale
Running on Qovery
Running on CapRover
Running on Koyeb
Running on Forge
Running on Fly.io
umami
Product
FeaturesPricing
Resources
DocsGuidesAPI ReferenceRelease Notes
Community
Get InvolvedGitHubDiscordTwitter
Company
AboutContactPrivacyTerms
© 2023 Umami Software, Inc.

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

GET /api/websites/{websiteId}/active

Gets the number of active users on a website.

Parameters

None

Sample example

GET from url: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/stats?startAt=1656679719687&endAt=1656766119687

{
  x: 5;
}
  • x: Number of unique visitors within the last 5 minutes

GET /api/websites/{websiteId}/events

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.
  • eventName: (optional) Name of event collected.

Sample response

URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/events?startAt=1683262800000&endAt=1683349199999&unit=hour&timezone=America%2FLos_Angeles

[
  { "x": "live-demo-button", "t": "2023-04-12 22:00:00", "y": 1 },
  { "x": "get-started-button", "t": "2023-04-12 22:00:00", "y": 5 },
  { "x": "get-started-button", "t": "2023-04-12 23:00:00", "y": 4 },
  { "x": "live-demo-button", "t": "2023-04-12 23:00:00", "y": 4 },
  { "x": "social-Discord", "t": "2023-04-13 00:00:00", "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.
  • pageTitle: (optional) Name of page title.
  • 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.

Query 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.
  • 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 example

URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/stats?startAt=1656679719687&endAt=1656766119687

{
  pageviews: { value: 5, change: 5 },
  uniques: { value: 1, change: 1 },
  bounces: { value: 0, change: 0 },
  totaltime: { value: 4, change: 4 }
}
  • pageviews: Pages hits
  • uniques: Number of unique visitors
  • bounces: Number of returning visitors
  • totaltime: 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).
  • unit: (optional) Time unit (year | month | hour | day).
  • timezone: (optional) Timezone (ex. America/Los_Angeles).
  • url: (optional) Name of URL.
  • referrer: (optional) Name of referrer.
  • pageTitle: (optional) Name of page title.
  • 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

[
    {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.