Get Analytics

Return statistics collected about various events, by event type, platform, campaign, etc

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
🚧

This end-point does not surface every statistics you can get from WonderPush, like the number of received notifications or viewed in-apps.
The POST /v1/stats/reports end-point exposes all the available statistics. It also exposes unique event counts, where you can get the number of notified users in a given time window instead of getting the total number of notifications sent.

Return statistics collected about various events, by event type, platform, campaign, etc.
Using @ALL will return statistics across, say, platforms.
Using @EACH will return statistics for each, say, platform.
You can also ask for a single or a subset of values, like for example platforms=Android,Web.

This API returns data with 3 different level of detail:

  • Global statistics, when campaignIds=@ALL which is the default.
  • Statistics for each campaign, when campaignIds=@EACH or when filtering against more than one campaign at a time.
  • Detailed statistics by notification for a single campaign, when using campaignIds=aSingleCampaignId.

@EACH can only be combined with @ALL, when you want to combine statistics, say, across all platforms, as well as to have the detail platform by platform.
By default, the API defaults to @ALL,@EACH. Only event types cannot be combined using @ALL as if would make little sense to add app opens to notifications sent.

The default output format groups counters into per-date objects as shown below:

{
  "data": [
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "counters": [
        {
          "type": "@NOTIFICATION_SENT",
          "count": 79
        },
        {
          "type": "@NOTIFICATION_SENT",
          "platform": "Android",
          "count": 42
        },
        {
          "type": "@NOTIFICATION_SENT",
          "platform": "iOS",
          "count": 37
        },
        "…"
      ]
    },
    "…"
  ]
}

You can also ask to merge the counters and date objects to yield what could be called data points:

{
  "data": [
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "count": 79
    },
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "platform": "Android",
      "count": 42
    },
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "platform": "iOS",
      "count": 37
    },
    "…"
  ]
}

Note that you will have as many objects sharing the same date as we had counters within the per-date object previously.

Let's say you are only interested in @NOTIFICATION_SENT events and want a single object per date, with a platform break-down. This is easily done by using both types=@NOTIFICATION_SENT and flatten=platforms:

{
  "data": [
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "@ALL": 79,
      "Android": 42,
      "iOS": 37
    },
    {
      "date": 1479254400000,
      "dateISO8601": "2016-11-16T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "@ALL": 61,
      "Android": 34,
      "iOS": 27
    },
    "…"
  ]
}

Note how the count field disappeared and the different values of platform have been changed into fields.

If you had not controlled the types to return, you would have gotten one object per date and per type, like we had in the previous example with the platforms.

In order to avoid name clashes (especially with custom event names) and to help better identify the counter fields, you can use a prefix.
Here is how the previous example would look by using flattenPrefix=platform::

{
  "data": [
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "platform:@ALL": 79,
      "platform:Android": 42,
      "platform:iOS": 37
    },
    {
      "date": 1479254400000,
      "dateISO8601": "2016-11-16T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "platform:@ALL": 61,
      "platform:Android": 34,
      "platform:iOS": 27
    },
    "…"
  ]
}

You can also opt for a sub-object if you prefer by ending the prefix with a dot. Here is an example using flattenPrefix=values.:

{
  "data": [
    {
      "date": 1479168000000,
      "dateISO8601": "2016-11-15T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "values": {
        "@ALL": 79,
        "Android": 42,
        "iOS": 37
      }
    },
    {
      "date": 1479254400000,
      "dateISO8601": "2016-11-16T00:00:00.000+00:00",
      "campaignId": "@ALL",
      "campaignName": "@ALL",
      "type": "@NOTIFICATION_SENT",
      "values": {
        "@ALL": 61,
        "Android": 34,
        "iOS": 27
      }
    },
    "…"
  ]
}

Note, we do not end-up with the default format here, there is no array of counters, but an object containing the flatten field's values as sub-fields and associated counts as values.

The addZero parameter will help you obtain a dense output. When a counter is 0, it is normally not even materialized into existence. The same is true if for a given date we have no counter. If using addZero=true we ensure that missing dates and counters are populated with 0s.

This leads us to the CSV format, controlled by using format=csv. CSV is a table-like format, it has a set of columns presented in the first row, and a list of rows that all have the same columns.
When using the CSV format, you basically impose flattening (using flatten=counters by default) and addZero=true. The keys that would be present in the data-point objects in JSON are all collected and form the set of columns, presented in the first header line. Following are each data-point object.
Note that if you did not sufficiently filtered the output (using platforms=@ALL for instance like before) you might have several lines for a given date.

Here is how the first example would look in CSV:

"date","dateISO8601","campaignId","campaignName","type","platform","count"
1479168000000,"2016-11-15T00:00:00.000+00:00","@ALL","@ALL","@NOTIFICATION_SENT","@ALL",79
1479168000000,"2016-11-15T00:00:00.000+00:00","@ALL","@ALL","@NOTIFICATION_SENT","Android",42
1479168000000,"2016-11-15T00:00:00.000+00:00","@ALL","@ALL","@NOTIFICATION_SENT","iOS",37
…

And here is how it would look in CSV by with types=@NOTIFICATION_SENT and flatten=platforms like a later example:

"date","dateISO8601","campaignId","campaignName","type","@ALL","Android","iOS"
1479168000000,"2016-11-15T00:00:00.000+00:00","@ALL","@ALL","@NOTIFICATION_SENT",79,42,37
1479254400000,"2016-11-16T00:00:00.000+00:00","@ALL","@ALL","@NOTIFICATION_SENT",61,34,27
…
Query Params
date

The oldest date to return statistics for.

date

The newest date to return statistics for. Defaults to now.

string
Defaults to day

Either day or hour. Returns statistics grouped day by day or hour by hour.

int32

How many days or hours since fromDate or until toDate to return. Maximum 30 days or 24 hours, which is the default.

platforms
array of strings

Comma-separated list of platforms to return. Accepts @ALL and @EACH.

platforms
types
array of strings

Comma-separated list of event types to return. Accepts @EACH.

types
campaignIds
array of strings

Comma-separated list of campaignIds to return. Accepts @ALL and @EACH. Use @NONE to select campaign statistics that were not bond to any particular campaignId (aka. null campaignId).

campaignIds
notificationIds
array of strings

Comma-separated list of notificationIds to return. Accepts @ALL and @EACH. The special value @1 regroups all notifications send directly to a single recipient.

notificationIds
buttonLabels
array of strings

Comma-separated list of button labels to return. If your button label contains a comma, send your request using a JSON body instead. Accepts @ALL and @EACH.

buttonLabels
string
Defaults to json

Either json or csv.

string

One of counters, platforms, types, campaignIds, notificationIds and buttonLabels. Change the output from a list of counters grouped inside date objects, to list of data points style. See below for more information.

string

To avoid name clashes when transforming your custom event types into fields you can prefix them. If you give a value ending with a dot, then the JSON output will put the values as subfields of the given field name. See below for more information.

boolean
Defaults to false

Whether to ensure that no dates are missing (if no counters inside it are nonzero), and every data point contains the same fields when flattening the output.

string
Defaults to CRLF

One of CR, LF and CRLF. What line ending flavor to use for the CSV output.

string
Defaults to ,

What field separator to use. Some tools might expect ;.

string
Defaults to "

What styles of quotes to use. You can use an empty value to disable quoting string fields, but you might experience corrupted output.

Response

Language
Credentials
Query
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json