Metrics
Get detailed usage reports through the REST API
Notifications sent through the REST API are not accounted for in the online dashboard analytics unless you specify a campaignId
parameter. See the Sending notifications guide for more details.
You can use our REST API to get detailed metrics for each of your campaigns using the /stats/events
endpoint.
For example, if you wish to get the number of notifications sent and clicked in the last 30 days, you can use the interval
parameters like this:
curl -XGET "https://management-api.wonderpush.com/v1/stats/events?accessToken=YOUR_APPLICATION_ACCESS_TOKEN&interval=30"
There is a complete reference of the available parameters in the REST API reference
The output is a JSON dictionary with a data
parameter that contains an array with one entry for each day or hour, depending on the resolution
you've specified (days by default):
{
"data": [
{
"campaignId": "@ALL",
"date": 1621987200000,
"dateISO8601": "2021-05-26T00:00:00.000+00:00",
"campaignName": "@ALL",
"counters": [
{
"count": 123,
"type": "@NOTIFICATION_SENT"
},
...
]
}
]
}
Each item in the data array has date
and dateISO8601
properties that reflect the beginning of the corresponding sample.
The campaignId
and campaignName
properties reflect the corresponding campaign, @ALL
being a special constant that means "All campaigns".
The counters
property is an array of data points, each with at least a count
and a type
, the type
describing the event for this data point. @NOTIFICATION_SENT
stands for the number of notifications sent, @NOTIFICATION_OPENED
stands for the number of notifications clicked, etc. The complete reference of built-in events is available here .
Some counters specify a platform
, in which case the data point is specific to that platform, other don't, meaning the data-point is an aggregate of all platforms.
The REST API lets you download usage data in an easy-to-consume format. See the [API reference] for a complete reference.
Updated over 3 years ago