关于事件及事件数据的操作。
端点
GET /api/websites/:websiteId/events
GET /api/websites/:websiteId/event-data/events
GET /api/websites/:websiteId/event-data/fields
GET /api/websites/:websiteId/event-data/values
GET /api/websites/:websiteId/event-data/stats
获取给定时间范围内的网站事件详细信息。
参数
startAt
: 开始日期的时间戳(毫秒)。endAt
: 结束日期的时间戳(毫秒)。query
: (可选字符串)搜索文本。page
: (可选数字,默认为 1)确定页码。pageSize
: (可选字符串)确定返回多少结果。orderBy
: (可选字符串)按列名排序。示例响应
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/events?startAt=1725580800000&endAt=1725667199999&query=&page=1&pageSize=20
{
"data": [
{
"id": "dbcfe5ef-99f4-44e1-ad3f-c157eb102a13",
"websiteId": "86d4095c-a2a8-4fc8-9521-103e858e2b41",
"sessionId": "970c97c5-2071-540a-be88-098eb730ccac",
"createdAt": "2024-09-06T23:36:44Z",
"urlPath": "/docs/api/authentication",
"urlQuery": "",
"referrerPath": "/docs/api",
"referrerQuery": "",
"referrerDomain": "",
"pageTitle": "总览 – Umami",
"eventType": 1,
"eventName": ""
},
{
"id": "9ba0da36-136b-4fef-afae-a5cdba78017b",
"websiteId": "86d4095c-a2a8-4fc8-9521-103e858e2b41",
"sessionId": "466cb31d-8cda-5dc3-9dd2-b259f29551a5",
"createdAt": "2024-09-06T23:36:33Z",
"urlPath": "/",
"urlQuery": "utm_source=apollo&utm_medium=outbound-email&utm_campaign=founders",
"referrerPath": "",
"referrerQuery": "",
"referrerDomain": "",
"pageTitle": "Umami",
"eventType": 1,
"eventName": ""
}
],
"count": 1000,
"page": 1,
"pageSize": 20
}
获取事件数据名称、属性和计数。
参数
startAt
: 开始日期的时间戳(毫秒)。endAt
: 结束日期的时间戳(毫秒)。event
: (可选)事件名称过滤。示例响应
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/event-data/events?startAt=1692115200000&endAt=169220159999
[
{ "eventName": "button-click", "propertyName": "id", "dataType": 1, "total": 4 },
{ "eventName": "button-click", "propertyName": "name", "dataType": 1, "total": 4 },
{ "eventName": "track-product", "propertyName": "price", "dataType": 2, "total": 2 }
]
获取给定时间范围内事件数据属性和值的计数。
参数
websiteId
: (uuid)网站的唯一标识符。startAt
: 开始日期的时间戳(毫秒)。endAt
: 结束日期的时间戳(毫秒)。示例响应
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/event-data/fields?startAt=1692115200000&endAt=169220159999
[
{ "propertyName": "age", "dataType": 2, "value": "33", "total": 1 },
{ "propertyName": "age", "dataType": 2, "value": "31", "total": 4 },
{ "propertyName": "gender", "dataType": 1, "value": "female", "total": 4 },
{ "propertyName": "gender", "dataType": 1, "value": "male", "total": 1 }
]
获取给定事件和属性的事件数据计数。
参数
startAt
: 开始日期的时间戳(毫秒)。endAt
: 结束日期的时间戳(毫秒)。eventName
: 事件名称。propertyName
: 属性名称。示例响应
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/event-data/values?startAt=1717916400000&endAt=1725692399999&eventName=survey&propertyName=gender
[
{ "value": "female", "total": 4 },
{ "value": "male", "total": 1 }
]
获取给定时间范围内总结的网站事件、字段和记录。
参数
startAt
: 开始日期的时间戳(毫秒)。endAt
: 结束日期的时间戳(毫秒)。示例响应
URL: https://umami.mydomain.com/api/websites/86d4095c-a2a8-4fc8-9521-103e858e2b41/event-data/stats?startAt=1725580800000&endAt=1725667199999
[{ "events": 16, "fields": 13, "records": 26 }]