-
Notifications
You must be signed in to change notification settings - Fork 1
Statistics
See Making API calls about making requests to the API.
This section of the API lets you retrieve various statistics and aggregate counts about the campaign.
Get returns general statistics and aggregates from the campaign
Example URL: https://premium.sales.lv/API:1.0/Key:1234567890abcdef/Code:demo/Statistics:General
HTTP method: GET
No parameters required.
Returns an associative array with statistics data:
-
int IDCampaign ID -
array TotalsTotal message counts. An associative array with four elements:-
BeforeMessages that were submitted before the campaign start time. If the campaign has no start time, no messages should be counted here. -
AfterMessages that were submitted after the campaign end time (if it has one). -
DuringMessages that are submitted during the campaign. -
TotalTotal message counts
Each of these elements is an associative array with this structure listing each message type (as defined in Messages) and a total value:
-
int SMSNumber of messages sent via SMS. -
int APINumber of messages submitted through this API. -
int OPERNumber of messages entered by call center operators. -
int TotalTotal message count
-
-
array AveragesAverage message counts per day. Contains three elements:-
TotalAverage message counts per day during all of campaign time -
WeekdaysAverage message counts per day during weekdays (Monday-Friday) -
WeekendsAverage message counts per day during weekends (Saturday and Sunday)
Here, too, each of these elements is an associative array with
SMS,API,OPERmessage counts, as well asTotalfor average value over all message types. -
-
array GendersGender counts for participants in campaigns they can be determined:int Maleint Female
The number returned is participant (end user) count, not message count. By default messages are recognized to be from the same participant by their phone number, although it is possible to set a different variable if necessary.
$API = new PremiumAPI('1234567890abcdef', 'demo');
$GeneralStats = $API -> Statistics_General();
print_r($GeneralStats);
Outputs:
Array
(
[ID] => 25
[Totals] => Array
(
[Before] => Array
(
[SMS] => 1
[API] => 0
[OPER] => 0
[Total] => 1
)
[During] => Array
(
[SMS] => 27
[API] => 4
[OPER] => 0
[Total] => 31
)
[After] => Array
(
[SMS] => 0
[API] => 1
[OPER] => 0
[Total] => 1
)
[Total] => Array
(
[SMS] => 28
[API] => 5
[OPER] => 0
[Total] => 33
)
)
[Averages] => Array
(
[Total] => Array
(
[SMS] => 0.59
[API] => 0.09
[OPER] => 0
[Total] => 0.67
)
[Weekends] => Array
(
[SMS] => 0.25
[API] => 0.08
[OPER] => 0
[Total] => 0.33
)
[Weekdays] => Array
(
[SMS] => 0.71
[API] => 0.09
[OPER] => 0
[Total] => 0.79
)
)
[Genders] => Array
(
[Male] => 12
[Female] => 17
)
)