Subscriber Analytics
The subscriber analytics summary provides stats on active subscribers for the entire site, breaking down the distribution of active subscribers across various dimensions, including categories like city, country, state, browser, and device. The response is in JSON format.
GET
https://api.pushengage.com/apiv1/subscribers/analytics/summary
Request Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| type | String | No | A comma-separated list of dimensions to be included in the response. Allowed dimensions include country, state, city, device, device_type, and platform. If the "type" parameter is not specified, the response will include all available dimensions. |
Response Object
| Property Name | Type | Required | Description |
|---|---|---|---|
| success | Boolean | Yes | Indicates whether the subscribers' analytics summary request succeeded or not. Value can be 'true' or 'false'. |
| data | Object | Yes | Summary of subscriber statistics. |
Example
Request
- cURL
- PHP
curl -X GET \
'https://api.pushengage.com/apiv1/subscribers/analytics/summary' \
-H 'Accept: */*' \
-H 'Api-Key: <your_pushengage_api_key>' \
-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/subscribers/analytics/summary",
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
- 400 Bad Request
- 401 Unauthorized
- 429 Too Many Requests
- 500 Internal Server Error
{
"success": true,
"data": {
"city": {
"Bangalore": 40
},
"country": {
"India": 100
},
"device": {
"desktop": 30
},
"device_type": {
"chrome": 40
},
"state": {
"Karnataka": 10
}
}
}
{
"success": false,
"message": "type must be one of city, country, device, device_type, platform or, state"
}
{
"success": false,
"error_code": "1001",
"message": "Invalid API Key"
}
{
"success": false,
"error_code": "1005",
"message": "API Cap Enabled. You can send 300 requests per minute."
}
{
"success": false,
"message": "Something went wrong at our servers. Please try after some time."
}