## Classes
Object
Object
Object
Object
Object
Object
Object
Object
Object
Promise.<GetTokenResponse>
](#GetTokenResponse)
* [.verifyToken()](#UmamiClient+verifyToken) ⇒ [Promise.<User>
](#User)
* [.createUser(params)](#UmamiClient+createUser) ⇒ Promise.<{id: string, username: string, role: string, createdAt: string}>
* [.getUsers()](#UmamiClient+getUsers) ⇒ Promise.<Array.<{id: string, username: string, role: string, createdAt: string}>>
* [.getUser(userId)](#UmamiClient+getUser) ⇒ Promise.<{id: string, username: string, role: string}>
* [.updateUser(userId, params)](#UmamiClient+updateUser) ⇒ Promise.<{id: string, username: string, role: string, createdAt: string}>
* [.deleteUser(userId)](#UmamiClient+deleteUser) ⇒ Promise.<string>
* [.getUserWebsites(userId, [params])](#UmamiClient+getUserWebsites) ⇒ Promise.<Array.<{id: string, userId: string, domain: string, name: string, shareId: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null), resetAt: (string\|null)}>>
* [.getUserTeams(userId, [params])](#UmamiClient+getUserTeams) ⇒ Promise.<Array.<{id: string, name: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
* [.createTeam(params)](#UmamiClient+createTeam) ⇒ Promise.<{accessCode: string, createdAt: string, id: string, name: string, updatedAt: (string\|null)}>
* [.getTeams(params)](#UmamiClient+getTeams) ⇒ Promise.<Array>
* [.joinTeam(params)](#UmamiClient+joinTeam) ⇒ Promise.<Object>
* [.getTeam(teamId)](#UmamiClient+getTeam) ⇒ Promise.<Object>
* [.updateTeam(teamId, params)](#UmamiClient+updateTeam) ⇒ Promise.<Object>
* [.deleteTeam(teamId)](#UmamiClient+deleteTeam) ⇒ Promise.<string>
* [.getTeamUsers(teamId, [params])](#UmamiClient+getTeamUsers) ⇒ Promise.<Array>
* [.addUserToTeam(teamId, params)](#UmamiClient+addUserToTeam) ⇒ Promise.<Object>
* [.getTeamUser(teamId, userId)](#UmamiClient+getTeamUser) ⇒ Promise.<Object>
* [.updateTeamUserRole(teamId, userId, params)](#UmamiClient+updateTeamUserRole) ⇒ Promise.<string>
* [.removeUserFromTeam(teamId, userId)](#UmamiClient+removeUserFromTeam) ⇒ Promise.<string>
* [.getWebsites([params])](#UmamiClient+getWebsites) ⇒ Promise.<Array.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
* [.createWebsite(params)](#UmamiClient+createWebsite) ⇒ Promise.<{id: number, websiteUuid: string, websiteId: number, name: string, domain: string, shareId: (string\|null), createdAt: string}>
* [.getWebsite(websiteId)](#UmamiClient+getWebsite) ⇒ Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
* [.updateWebsite(websiteId, params)](#UmamiClient+updateWebsite) ⇒ Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
* [.deleteWebsite(websiteId)](#UmamiClient+deleteWebsite) ⇒ Promise.<string>
* [.resetWebsite(websiteId)](#UmamiClient+resetWebsite) ⇒ Promise.<string>
* [.getTeamWebsites(teamId, [params])](#UmamiClient+getTeamWebsites) ⇒ Promise.<Array>
* [.getSessions(websiteId, params)](#UmamiClient+getSessions) ⇒ Promise.<{data: Array.<Session>, count: number, page: number, pageSize: number}>
* [.getSessionStats(websiteId, params)](#UmamiClient+getSessionStats) ⇒ [Promise.<SessionStats>
](#SessionStats)
* [.getSession(websiteId, sessionId)](#UmamiClient+getSession) ⇒ [Promise.<Session>
](#Session)
* [.getSessionActivity(websiteId, sessionId, params)](#UmamiClient+getSessionActivity) ⇒ Promise.<Array.<SessionActivity>>
* [.getSessionProperties(websiteId, sessionId)](#UmamiClient+getSessionProperties) ⇒ Promise.<Array.<SessionProperty>>
* [.getSessionDataProperties(websiteId, params)](#UmamiClient+getSessionDataProperties) ⇒ Promise.<Array.<PropertyCount>>
* [.getSessionDataValues(websiteId, params)](#UmamiClient+getSessionDataValues) ⇒ Promise.<Array.<PropertyValue>>
* [.getWebsites([params])](#UmamiClient+getWebsites) ⇒ Promise.<Array>
* [.createWebsite(params)](#UmamiClient+createWebsite) ⇒ Promise.<Object>
* [.getWebsite(websiteId)](#UmamiClient+getWebsite) ⇒ Promise.<Object>
* [.updateWebsite(websiteId, params)](#UmamiClient+updateWebsite) ⇒ Promise.<Object>
* [.deleteWebsite(websiteId)](#UmamiClient+deleteWebsite) ⇒ Promise.<string>
* [.resetWebsite(websiteId)](#UmamiClient+resetWebsite) ⇒ Promise.<string>
* [.getActiveUsers(websiteId)](#UmamiClient+getActiveUsers) ⇒ Promise.<Object>
* [.getEventsSeries(websiteId, params)](#UmamiClient+getEventsSeries) ⇒ Promise.<Array>
* [.getWebsiteEvents(websiteId, params)](#UmamiClient+getWebsiteEvents) ⇒ Promise.<{data: Array, count: number, page: number, pageSize: number}>
* [.getWebsiteStats(websiteId, params)](#UmamiClient+getWebsiteStats) ⇒ Promise.<{pageviews: {value: number, prev: number}, visitors: {value: number, prev: number}, visits: {value: number, prev: number}, bounces: {value: number, prev: number}, totaltime: {value: number, prev: number}}>
* [.getEventDataEvents(websiteId, params)](#UmamiClient+getEventDataEvents) ⇒ Promise.<Array.<{eventName: string, propertyName: string, dataType: number, total: number}>>
* [.getEventDataFields(websiteId, params)](#UmamiClient+getEventDataFields) ⇒ Promise.<Array.<{propertyName: string, dataType: number, value: string, total: number}>>
* [.getEventDataValues(websiteId, params)](#UmamiClient+getEventDataValues) ⇒ Promise.<Array.<{value: string, total: number}>>
* [.getEventDataStats(websiteId, params)](#UmamiClient+getEventDataStats) ⇒ Promise.<Array.<{events: number, fields: number, records: number}>>
* [.getPageviews(websiteId, params)](#UmamiClient+getPageviews) ⇒ Promise.<Object>
* [.getMetrics(websiteId, params)](#UmamiClient+getMetrics) ⇒ Promise.<Array>
* [.sendEvent(payload)](#UmamiClient+sendEvent) ⇒ Promise.<void>
### new UmamiClient(config)
Creates a new UmamiClient instance
| Param | Type | Description |
| --- | --- | --- |
| config | Object
| Configuration options |
| config.baseUrl | string
| Base URL for the Umami API |
| config.username | string
| Umami username |
| config.password | string
| Umami password |
### umamiClient.authenticate() ⇒ [Promise.<GetTokenResponse>
](#GetTokenResponse)
Authenticates with the Umami API
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: [Promise.<GetTokenResponse>
](#GetTokenResponse) - Authentication response
**Throws**:
- Error
If authentication fails
### umamiClient.verifyToken() ⇒ [Promise.<User>
](#User)
Verifies the current authentication token
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: [Promise.<User>
](#User) - User information if token is valid
### umamiClient.createUser(params) ⇒ Promise.<{id: string, username: string, role: string, createdAt: string}>
Creates a new user.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: string, username: string, role: string, createdAt: string}>
- Created user details.
| Param | Type | Description |
| --- | --- | --- |
| params | Object
| Parameters for creating a user. |
| params.username | string
| The user's username. |
| params.password | string
| The user's password. |
| params.role | string
| The user's role, either 'admin' or 'user'. |
### umamiClient.getUsers() ⇒ Promise.<Array.<{id: string, username: string, role: string, createdAt: string}>>
Returns all users. Admin access is required.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{id: string, username: string, role: string, createdAt: string}>>
- List of users.
### umamiClient.getUser(userId) ⇒ Promise.<{id: string, username: string, role: string}>
Gets details of a specific user by ID.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: string, username: string, role: string}>
- User details.
| Param | Type | Description |
| --- | --- | --- |
| userId | string
| The ID of the user. |
### umamiClient.updateUser(userId, params) ⇒ Promise.<{id: string, username: string, role: string, createdAt: string}>
Updates details of a user.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: string, username: string, role: string, createdAt: string}>
- Updated user details.
| Param | Type | Description |
| --- | --- | --- |
| userId | string
| The ID of the user. |
| params | Object
| Update parameters. |
| [params.username] | string
| The user's new username (optional). |
| [params.password] | string
| The user's new password (optional). |
| [params.role] | string
| The user's role, either 'admin' or 'user' (optional). |
### umamiClient.deleteUser(userId) ⇒ Promise.<string>
Deletes a user.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| userId | string
| The ID of the user. |
### umamiClient.getUserWebsites(userId, [params]) ⇒ Promise.<Array.<{id: string, userId: string, domain: string, name: string, shareId: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null), resetAt: (string\|null)}>>
Gets all websites that belong to a user.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{id: string, userId: string, domain: string, name: string, shareId: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null), resetAt: (string\|null)}>>
- List of websites belonging to the user.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| userId | string
| | The ID of the user. |
| [params] | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.getUserTeams(userId, [params]) ⇒ Promise.<Array.<{id: string, name: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
Gets all teams that belong to a user.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{id: string, name: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
- List of teams belonging to the user.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| userId | string
| | The ID of the user. |
| [params] | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.createTeam(params) ⇒ Promise.<{accessCode: string, createdAt: string, id: string, name: string, updatedAt: (string\|null)}>
Creates a new team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{accessCode: string, createdAt: string, id: string, name: string, updatedAt: (string\|null)}>
- Created team details.
| Param | Type | Description |
| --- | --- | --- |
| params | Object
| Parameters for creating a team. |
| params.name | string
| The team's name. |
### umamiClient.getTeams(params) ⇒ Promise.<Array>
Returns all teams.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- List of all teams with team user information.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| params | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.joinTeam(params) ⇒ Promise.<Object>
Joins a team using an access code.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Joined team details.
| Param | Type | Description |
| --- | --- | --- |
| params | Object
| Parameters for joining a team. |
| params.accessCode | string
| The team's access code. |
### umamiClient.getTeam(teamId) ⇒ Promise.<Object>
Gets details of a specific team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Team details.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
### umamiClient.updateTeam(teamId, params) ⇒ Promise.<Object>
Updates team details.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Updated team details.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
| params | Object
| Update parameters. |
| [params.name] | string
| The team's name (optional). |
| [params.accessCode] | string
| The team's access code (optional). |
### umamiClient.deleteTeam(teamId) ⇒ Promise.<string>
Deletes a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
### umamiClient.getTeamUsers(teamId, [params]) ⇒ Promise.<Array>
Gets all users that belong to a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- List of team users.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| teamId | string
| | The ID of the team. |
| [params] | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.addUserToTeam(teamId, params) ⇒ Promise.<Object>
Adds a user to a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Added team user details.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
| params | Object
| Parameters for adding a user to the team. |
| params.userId | string
| The user's ID. |
| params.role | string
| The role to assign (e.g., 'member' or 'view-only'). |
### umamiClient.getTeamUser(teamId, userId) ⇒ Promise.<Object>
Gets details of a user in a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Team user details.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
| userId | string
| The user's ID. |
### umamiClient.updateTeamUserRole(teamId, userId, params) ⇒ Promise.<string>
Updates a user's role in a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
| userId | string
| The user's ID. |
| params | Object
| Parameters for updating user role. |
| params.role | string
| The new role (e.g., 'member' or 'view-only'). |
### umamiClient.removeUserFromTeam(teamId, userId) ⇒ Promise.<string>
Removes a user from a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| teamId | string
| The ID of the team. |
| userId | string
| The user's ID. |
### umamiClient.getWebsites([params]) ⇒ Promise.<Array.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
Returns all tracked websites.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>>
- List of websites.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [params] | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.createWebsite(params) ⇒ Promise.<{id: number, websiteUuid: string, websiteId: number, name: string, domain: string, shareId: (string\|null), createdAt: string}>
Creates a new website.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: number, websiteUuid: string, websiteId: number, name: string, domain: string, shareId: (string\|null), createdAt: string}>
- Details of the created website.
| Param | Type | Description |
| --- | --- | --- |
| params | Object
| Website parameters. |
| params.domain | string
| The full domain of the tracked website. |
| params.name | string
| The name of the website in Umami. |
| [params.shareId] | string
| A unique string to enable a share URL (optional). |
| [params.teamId] | string
| The ID of the team the website will be created under (optional). |
### umamiClient.getWebsite(websiteId) ⇒ Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
Gets details of a specific website by ID.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
- Website details.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
### umamiClient.updateWebsite(websiteId, params) ⇒ Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
Updates details of a website.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{id: string, name: string, domain: string, shareId: (string\|null), resetAt: (string\|null), userId: string, createdAt: string, updatedAt: (string\|null), deletedAt: (string\|null)}>
- Updated website details.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Update parameters. |
| [params.name] | string
| The name of the website in Umami (optional). |
| [params.domain] | string
| The full domain of the tracked website (optional). |
| [params.shareId] | string
| A unique string to enable a share URL or null to unshare (optional). |
### umamiClient.deleteWebsite(websiteId) ⇒ Promise.<string>
Deletes a website.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
### umamiClient.resetWebsite(websiteId) ⇒ Promise.<string>
Resets a website by removing all data related to it.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
### umamiClient.getTeamWebsites(teamId, [params]) ⇒ Promise.<Array>
Gets all websites that belong to a team.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- List of team websites.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| teamId | string
| | The ID of the team. |
| [params] | Object
| | Query parameters. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results per page (optional). |
| [params.orderBy] | string
| "'name'"
| Order by column name (optional). |
### umamiClient.getSessions(websiteId, params) ⇒ Promise.<{data: Array.<Session>, count: number, page: number, pageSize: number}>
Gets website session details within a given time range
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| websiteId | string
| | Website ID |
| params | Object
| | Query parameters |
| params.startAt | number
| | Timestamp (in ms) of starting date |
| params.endAt | number
| | Timestamp (in ms) of end date |
| [params.query] | string
| | Search text |
| [params.page] | number
| 1
| Page number |
| [params.pageSize] | number
| | Results per page |
| [params.orderBy] | string
| | Order by column name |
### umamiClient.getSessionStats(websiteId, params) ⇒ [Promise.<SessionStats>
](#SessionStats)
Gets summarized website session statistics
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
| [params.url] | string
| Filter by URL |
| [params.referrer] | string
| Filter by referrer |
| [params.title] | string
| Filter by page title |
| [params.query] | string
| Filter by query |
| [params.event] | string
| Filter by event name |
| [params.host] | string
| Filter by hostname |
| [params.os] | string
| Filter by operating system |
| [params.browser] | string
| Filter by browser |
| [params.device] | string
| Filter by device |
| [params.country] | string
| Filter by country |
| [params.region] | string
| Filter by region |
| [params.city] | string
| Filter by city |
### umamiClient.getSession(websiteId, sessionId) ⇒ [Promise.<Session>
](#Session)
Gets session details for an individual session
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| sessionId | string
| Session ID |
### umamiClient.getSessionActivity(websiteId, sessionId, params) ⇒ Promise.<Array.<SessionActivity>>
Gets session activity for an individual session
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| sessionId | string
| Session ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
### umamiClient.getSessionProperties(websiteId, sessionId) ⇒ Promise.<Array.<SessionProperty>>
Gets session properties for an individual session
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| sessionId | string
| Session ID |
### umamiClient.getSessionDataProperties(websiteId, params) ⇒ Promise.<Array.<PropertyCount>>
Gets session data counts by property name
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
### umamiClient.getSessionDataValues(websiteId, params) ⇒ Promise.<Array.<PropertyValue>>
Gets session data counts for a given property
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
| params.propertyName | string
| Property name |
### umamiClient.getWebsites([params]) ⇒ Promise.<Array>
Gets all tracked websites
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- List of websites
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [params] | Object
| | Query parameters |
| [params.query] | string
| | Search text |
| [params.page] | number
| 1
| Page number |
| [params.pageSize] | number
| | Results per page |
| [params.orderBy] | string
| "'name'"
| Order by column name |
### umamiClient.createWebsite(params) ⇒ Promise.<Object>
Creates a new website
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Created website details
| Param | Type | Description |
| --- | --- | --- |
| params | Object
| Website parameters |
| params.domain | string
| The full domain of the tracked website |
| params.name | string
| The name of the website in Umami |
| [params.shareId] | string
| A unique string to enable a share url |
| [params.teamId] | string
| The ID of the team the website will be created under |
### umamiClient.getWebsite(websiteId) ⇒ Promise.<Object>
Gets a website by ID
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Website details
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
### umamiClient.updateWebsite(websiteId, params) ⇒ Promise.<Object>
Updates a website
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Updated website details
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Update parameters |
| [params.name] | string
| The name of the website in Umami |
| [params.domain] | string
| The full domain of the tracked website |
| [params.shareId] | string
| A unique string to enable a share url |
### umamiClient.deleteWebsite(websiteId) ⇒ Promise.<string>
Deletes a website
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
### umamiClient.resetWebsite(websiteId) ⇒ Promise.<string>
Resets a website by removing all data
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<string>
- Confirmation message
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
### umamiClient.getActiveUsers(websiteId) ⇒ Promise.<Object>
Gets the number of active users on a website
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Active users count
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
### umamiClient.getEventsSeries(websiteId, params) ⇒ Promise.<Array>
Gets events within a given time range
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- Event series data
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
| params.unit | string
| Time unit (year | month | hour | day) |
| params.timezone | string
| Timezone (ex. America/Los_Angeles) |
| [params.url] | string
| Filter by URL |
| [params.referrer] | string
| Filter by referrer |
| [params.title] | string
| Filter by page title |
| [params.host] | string
| Filter by hostname |
| [params.os] | string
| Filter by operating system |
| [params.browser] | string
| Filter by browser |
| [params.device] | string
| Filter by device |
| [params.country] | string
| Filter by country |
| [params.region] | string
| Filter by region |
| [params.city] | string
| Filter by city |
### umamiClient.getWebsiteEvents(websiteId, params) ⇒ Promise.<{data: Array, count: number, page: number, pageSize: number}>
Gets website event details within a given time range.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{data: Array, count: number, page: number, pageSize: number}>
- Event data response.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| websiteId | string
| | The ID of the website. |
| params | Object
| | Query parameters. |
| params.startAt | number
| | Timestamp (in ms) of the starting date. |
| params.endAt | number
| | Timestamp (in ms) of the end date. |
| [params.query] | string
| | Search text (optional). |
| [params.page] | number
| 1
| Page number (optional). |
| [params.pageSize] | number
| | Number of results to return (optional). |
| [params.orderBy] | string
| | Order by column name (optional). |
### umamiClient.getWebsiteStats(websiteId, params) ⇒ Promise.<{pageviews: {value: number, prev: number}, visitors: {value: number, prev: number}, visits: {value: number, prev: number}, bounces: {value: number, prev: number}, totaltime: {value: number, prev: number}}>
Gets summarized website statistics.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<{pageviews: {value: number, prev: number}, visitors: {value: number, prev: number}, visits: {value: number, prev: number}, bounces: {value: number, prev: number}, totaltime: {value: number, prev: number}}>
- Summarized website statistics.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Query parameters. |
| params.startAt | number
| Timestamp (in ms) of starting date. |
| params.endAt | number
| Timestamp (in ms) of end date. |
| [params.url] | string
| Filter by URL (optional). |
| [params.referrer] | string
| Filter by referrer (optional). |
| [params.title] | string
| Filter by page title (optional). |
| [params.query] | string
| Filter by query (optional). |
| [params.event] | string
| Filter by event name (optional). |
| [params.host] | string
| Filter by hostname (optional). |
| [params.os] | string
| Filter by operating system (optional). |
| [params.browser] | string
| Filter by browser (optional). |
| [params.device] | string
| Filter by device (e.g., Mobile, optional). |
| [params.country] | string
| Filter by country (optional). |
| [params.region] | string
| Filter by region/state/province (optional). |
| [params.city] | string
| Filter by city (optional). |
### umamiClient.getEventDataEvents(websiteId, params) ⇒ Promise.<Array.<{eventName: string, propertyName: string, dataType: number, total: number}>>
Gets event data names, properties, and counts.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{eventName: string, propertyName: string, dataType: number, total: number}>>
- Event data summary.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Query parameters. |
| params.startAt | number
| Timestamp (in ms) of the starting date. |
| params.endAt | number
| Timestamp (in ms) of the end date. |
| [params.event] | string
| Event name filter (optional). |
### umamiClient.getEventDataFields(websiteId, params) ⇒ Promise.<Array.<{propertyName: string, dataType: number, value: string, total: number}>>
Gets event data property and value counts within a given time range.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{propertyName: string, dataType: number, value: string, total: number}>>
- Event data fields.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Query parameters. |
| params.startAt | number
| Timestamp (in ms) of the starting date. |
| params.endAt | number
| Timestamp (in ms) of the end date. |
### umamiClient.getEventDataValues(websiteId, params) ⇒ Promise.<Array.<{value: string, total: number}>>
Gets event data counts for a given event and property.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{value: string, total: number}>>
- Event data values.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Query parameters. |
| params.startAt | number
| Timestamp (in ms) of the starting date. |
| params.endAt | number
| Timestamp (in ms) of the end date. |
| params.eventName | string
| The name of the event. |
| params.propertyName | string
| The property name. |
### umamiClient.getEventDataStats(websiteId, params) ⇒ Promise.<Array.<{events: number, fields: number, records: number}>>
Gets summarized website events, fields, and records within a given time range.
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array.<{events: number, fields: number, records: number}>>
- Summary of events, fields, and records.
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| The ID of the website. |
| params | Object
| Query parameters. |
| params.startAt | number
| Timestamp (in ms) of the starting date. |
| params.endAt | number
| Timestamp (in ms) of the end date. |
### umamiClient.getPageviews(websiteId, params) ⇒ Promise.<Object>
Gets pageviews within a given time range
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Object>
- Pageview data
| Param | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| params | Object
| Query parameters |
| params.startAt | number
| Timestamp (in ms) of starting date |
| params.endAt | number
| Timestamp (in ms) of end date |
| params.unit | string
| Time unit (year | month | hour | day) |
| params.timezone | string
| Timezone (ex. America/Los_Angeles) |
| [params.url] | string
| Filter by URL |
| [params.referrer] | string
| Filter by referrer |
| [params.title] | string
| Filter by page title |
| [params.host] | string
| Filter by hostname |
| [params.os] | string
| Filter by operating system |
| [params.browser] | string
| Filter by browser |
| [params.device] | string
| Filter by device |
| [params.country] | string
| Filter by country |
| [params.region] | string
| Filter by region |
| [params.city] | string
| Filter by city |
### umamiClient.getMetrics(websiteId, params) ⇒ Promise.<Array>
Gets metrics for a given time range
**Kind**: instance method of [UmamiClient
](#UmamiClient)
**Returns**: Promise.<Array>
- Metrics data
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| websiteId | string
| | Website ID |
| params | Object
| | Query parameters |
| params.startAt | number
| | Timestamp (in ms) of starting date |
| params.endAt | number
| | Timestamp (in ms) of end date |
| params.type | string
| | Metrics type (url | referrer | browser | os | device | country | event) |
| [params.url] | string
| | Filter by URL |
| [params.referrer] | string
| | Filter by referrer |
| [params.title] | string
| | Filter by page title |
| [params.query] | string
| | Filter by query |
| [params.host] | string
| | Filter by hostname |
| [params.os] | string
| | Filter by operating system |
| [params.browser] | string
| | Filter by browser |
| [params.device] | string
| | Filter by device |
| [params.country] | string
| | Filter by country |
| [params.region] | string
| | Filter by region |
| [params.city] | string
| | Filter by city |
| [params.language] | string
| | Filter by language |
| [params.event] | string
| | Filter by event |
| [params.limit] | number
| 500
| Number of events returned |
### umamiClient.sendEvent(payload) ⇒ Promise.<void>
Sends an event to Umami
**Kind**: instance method of [UmamiClient
](#UmamiClient)
| Param | Type | Description |
| --- | --- | --- |
| payload | [EventPayload
](#EventPayload) | Event data |
## User : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| id | string
| The user's unique identifier |
| username | string
| The user's username |
| role | string
| The user's role |
| createdAt | Date
| When the user was created |
| isAdmin | boolean
| Whether the user has admin privileges |
## GetTokenResponse : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| token | string
| Authentication token |
| user | [User
](#User) | User information |
## EventPayload : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| hostname | string
| Name of host |
| language | string
| Language of visitor (e.g., "en-US") |
| referrer | string
| Referrer URL |
| screen | string
| Screen resolution (e.g., "1920x1080") |
| title | string
| Page title |
| url | string
| Page URL |
| website | string
| Website ID |
| name | string
| Name of the event |
| [data] | Object
| Optional additional data for the event |
## Session : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| id | string
| Session ID |
| websiteId | string
| Website ID |
| hostname | string
| Hostname |
| browser | string
| Browser name |
| os | string
| Operating system |
| device | string
| Device type |
| screen | string
| Screen resolution |
| language | string
| Language code |
| country | string
| Country code |
| subdivision1 | string
| Region/state code |
| city | string
| City name |
| firstAt | string
| First activity timestamp |
| lastAt | string
| Last activity timestamp |
| visits | number
| Number of visits |
| views | number
| Number of page views |
| createdAt | string
| Creation timestamp |
## SessionStats : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| pageviews | Object
| Pages hits |
| visitors | Object
| Number of unique visitors |
| visits | Object
| Number of sessions |
| countries | Object
| Number of unique countries |
| events | Object
| Number of custom events |
## SessionActivity : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| createdAt | string
| Activity timestamp |
| urlPath | string
| URL path |
| urlQuery | string
| URL query parameters |
| referrerDomain | string
| Referrer domain |
| eventId | string
| Event ID |
| eventType | number
| Event type |
| eventName | string
| Event name |
| visitId | string
| Visit ID |
## SessionProperty : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| websiteId | string
| Website ID |
| sessionId | string
| Session ID |
| dataKey | string
| Property key |
| dataType | number
| Data type |
| stringValue | string
\| null
| String value |
| numberValue | number
\| null
| Number value |
| dateValue | string
\| null
| Date value |
| createdAt | string
| Creation timestamp |
## PropertyCount : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| propertyName | string
| Name of the property |
| total | number
| Total count |
## PropertyValue : Object
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| value | string
| Property value |
| total | number
| Total count |