getStats

Description

Get basic mailing list stats containing number of views, clicks, sent emails, bounced, spam reports and total subscribers.



Params

NameTypeDescription
apiKeystringAPI key previously generated.
idintegerOptional parameter if you want to get stats for a single mailing list. If not set, will return for all mailing lists.
startDatestringOptional parameter for start date. Must be in the following format: YYYY-MM-DD HH:MM:SS.
endDatestringOptional parameter for end date. Must be in the following format: YYYY-MM-DD HH:MM:SS.
smtpTagsarrayOptional parameter to search for messages with specific smtp tags. You must be provide an array of smtp tags ids.

 

Returned data

Type: array

Description: Return array with stats data ( views, unique views, clicks, unique clicks, number of messages sent, bounced, total subscribers and reported spam ).

 

Json sample code

<?php

$curl = curl_init('https://your_url/ccm/admin/api/version/2/&type=json');

$postData = array(
    'function' => 'getStats',
    'apiKey' => 'yourApiKey',
);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$json = curl_exec($curl);
if ($json === false) {
    die('Request failed with error: '. curl_error($curl));
}

$result = json_decode($json);
if ($result->status == 0) {
    die('Bad status returned. Error: '. $result->error);
}

var_dump($result->data);

 

Result of API call

stdClass Object
(
    [impressions] => 28
    [unique_impressions] => 22
    [clicks] => 12
    [unique_clicks] => 10
    [sent] => 0
    [bounced] => 4
    [reported_spam] => 0
    [optouts] => 0
    [forwarded] => 0
)