Summary Analytics
This endpoint retrieves the analytics summary for a specified date range. The summary includes subscriber count, unsubscribe count, notifications sent, notifications viewed, notifications clicked, and the click-through rate (CTR). The response is in JSON format.
GET
https://api.pushengage.com/apiv1/analytics/summary
Request Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
from | Date | Yes | The date from which the user wants summary analytics in ISO 8601 format (YYYY-MM-DD). |
to | Date | Yes | The date until which the user wants summary analytics in ISO 8601 format (YYYY-MM-DD). |
group_by | String | Yes | Specifies how the analytics will be grouped (e.g., by days, weeks, or months). |
Response Object
Property Name | Type | Required | Description |
---|---|---|---|
success | Boolean | Yes | Indicates whether the analytics summary request succeeded or not. Value can be 'true' or 'false'. |
data | Analytics[] | Yes | Denotes the name of the analytics object. |
Analytics Object
Property Name | Type | Description |
---|---|---|
date | String | Indicates the date range for summary analytics. |
subscriber_count | Number | Total number of new subscribers. |
desktop_subscriber_count | Number | Total number of new desktop subscribers. |
mobile_subscriber_count | Number | Total number of new mobile subscribers. |
unsubscribed_count | Number | Total number of unsubscribed subscribers. |
desktop_unsubscribed_count | Number | Total number of subscribers who unsubscribed from the desktop. |
mobile_unsubscribed_count | Number | Total number of subscribers who unsubscribed from the mobile. |
notification_sent | Number | Total number of notifications sent. |
net_subscriber_sent | Number | Total number of notifications sent to subscribers. |
view_count | Number | Total number of notifications viewed. |
click_count | Number | Total number of notifications clicked. |
ctr | Number | Click Through Rate (click_count / view_count * 100). |
Example
Request
- cURL
- PHP
curl -X GET \
'https://api.pushengage.com/apiv1/analytics/summary?from=2019-01-01&to=2019-04-01&group_by=day' \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Api_key: <your_pushengage_api_key>' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.pushengage.com/apiv1/analytics/summary?from=2019-01-01&to=2019-04-01&group_by=day",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Api_key: <your_pushengage_api_key>",
"Content-Type: application/json",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Response
- 200 OK
- 401 Unauthorized
- 400 Bad Request
{
"success": true,
"data": [
{
"date": "2019-01-01",
"subscriber_count": 10207,
"desktop_subscriber_count": 1618,
"mobile_subscriber_count": 8589,
"unsubscribed_count": 9211,
"desktop_unsubscribed_count": 1497,
"mobile_unsubscribed_count": 7714,
"notification_sent": 7256,
"net_subscriber_sent": 11802527,
"view_count": 5369622,
"click_count": 118196,
"ctr": 2.2
}
]
}
{
"success": false,
"message": "API KEY Invalid"
}
{
"success": false,
"error": {
"name": "InvalidRequestException",
"message": "Error Message"
}
}