Skip to content

Subscriber Analytics

Getting Started

Introduction

Subscribers analytics summary provides active subscribers stats for entire site, allowing to find distribution of active subscribes along various dimensions.The endpoint allows breaking down the response by country, state, city, device, device_type(browser) and platform(OS).

Getting Summary Analytics

Request URL

https://api.pushengage.com/apiv1/subscribers/analytics/summary

Method

GET

Request Parameters

Optional Parameters

Parameter Name Parameter Type Description
type String Comma separated list of dimension to be included in the response. Allowed dimensions are country, state, city, device, device_type, platform. If type params is not specified then response includes all dimensions.

Response Objects

Property Name Property Type Description
success Boolean Indicates subscribers analytics summary request succeeded or not. Value can be 'true' or 'false'.
data Object Subscriber stats summary.

Example

Request

curl -X GET \
  'https://staging-capi1.pushengage.com/apiv1/subscribers/analytics/summary' \
  -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://staging-capi1.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(
    "Accept: */*",
    "Accept-Encoding: gzip, deflate",
    "Api_key: <your_pushengage_api_key>",
    "Cache-Control: no-cache",
    "Connection: keep-alive",
    "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

{
  "success": true,
  "data": {
    "city": {
      "Bangalore": 40,
    },
    "country": {
      "India": 100
    },
    "device": {
      "desktop": 30
    },
    "device_type": {
      "chrome": 40
    },
    "state": {
      "Karnataka": 0
    },
    "platform" {
      "Windows 10": 22
    }
  }
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "success": false,
  "message": "type must be one of city, country, device, device_type, platform or state"
}