This web service responds with the number of events logged during a selected period.
- Use the Retrieve events web service to retrieve the events themselves.
- For an introduction to events, see Analytics events.
Method | Endpoint |
---|---|
POST |
/analytics/api/v1/traffic/event-counts |
Request example
The following lines show an example of a JSON request body:
{
"startDate": "2022-09-01",
"endDate": "2022-10-01",
"groupByPeriod": "month",
"filters": {
"name": [
"khub.search",
"feedback.send"
]
}
}
Field | Type | Required? | Description |
---|---|---|---|
startDate |
String | Yes | The inclusive start date of the period. Must be in the past year. |
endDate |
String | Yes | The exclusive end date of the period. Must be later than the startDate . |
groupByPeriod |
String | Yes | The period by which to group the events. Valid values are month , week , and day . |
filters |
Object | No | An optional field to specify which events to retrieve. If this field is absent or undefined, the web service returns data for all events. |
name |
Array | No | An array containing the names of the events to retrieve. Valid values are listed here. If undefined, the web service returns data for all events. |
Response body
The following lines show an example of a JSON response body:
{
"startDate": "2022-09-01",
"endDate": "2022-10-01",
"groupByPeriod": "month",
"results": [
{
"name": "khub.search",
"periods": [
{
"periodStartDate": "2022-09-01",
"periodEndDate": "2022-10-01",
"eventCount": 24
}
]
},
{
"name": "feedback.send",
"periods": [
{
"periodStartDate": "2022-09-01",
"periodEndDate": "2022-10-01",
"eventCount": 3
}
]
}
]
}
Field | Type | Description |
---|---|---|
startDate |
String | The inclusive start date of the period. |
endDate |
String | The exclusive end date of the period. |
groupByPeriod |
String | The period by which results are grouped. |
results |
Array | An array containing the results. |
name |
String | The name of the event. |
periods |
Array | An array containing data for the requested periods. |
periodStartDate |
String | The inclusive start date of the period. |
periodEndDate |
String | The exclusive end date of the period. |
eventCount |
Number | The number of events logged during the period. |
Return code | Description |
---|---|
200 OK |
Returns 0 or more results. |