https://github.com/imjuniper/umami-api-client
🍙 Simple, tiny API client for Umami analytics.
https://github.com/imjuniper/umami-api-client
analytics api hacktoberfest npm-module npm-package umami umami-analytics
Last synced: 6 months ago
JSON representation
🍙 Simple, tiny API client for Umami analytics.
- Host: GitHub
- URL: https://github.com/imjuniper/umami-api-client
- Owner: imjuniper
- License: mit
- Archived: true
- Created: 2022-07-14T21:42:22.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T16:03:44.000Z (7 months ago)
- Last Synced: 2025-04-19T05:26:34.456Z (6 months ago)
- Topics: analytics, api, hacktoberfest, npm-module, npm-package, umami, umami-analytics
- Language: TypeScript
- Homepage: https://npm.im/umami-api
- Size: 924 KB
- Stars: 12
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
> [!WARNING]
> I no longer work in web development and I don't really have the time or interest in maintaining this repository anymore. It has been incompatible with umami for a while and it would take me too much time to update it. However, if anybody is interested in maintaining it, I would gladly transfer the repository and NPM package# Umami API Client



🍙 Simple, tiny API client for Umami analytics.
## Installation
```shell
npm install umami-api
```## Usage
```ts
import UmamiAPIClient from "umami-api";
```### Setting default options
Default options can be set with the following environment variables:
- `UMAMI_CLIENT_TIMEOUT_MS`: Axios timeout in milliseconds. Default: `2000`.
- `UMAMI_CLIENT_USER_AGENT`: User agent to use for requests. Default: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0`.
- `UMAMI_CLIENT_TIME_PERIOD`: Default time period for pageviews, events, etc. Default: `24h`.
- `UMAMI_CLIENT_TIME_UNIT`: Default time unit for pageviews, events, etc. Default: `hour`.
- `UMAMI_CLIENT_TIMEZONE`: Default timezone for pageviews, events, etc. Default: `America/Toronto`.
- `UMAMI_CLIENT_METRIC_TYPE`: Default metric type to get. Default: `url`.## Example
```ts
import UmamiAPIClient from "umami-api";const umami = new UmamiAPIClient("stats.example.com", "username", "password");
const newWebsite = await umami.createWebsite({
domain: "test.com",
name: "test.com",
enableShareUrl: false,
});const pageviews = await newWebsite.getPageviews();
const metrics = await newWebsite.getMetrics();
```