campaignClickStatsDetails()

Detailed list of email clicks that were made in given campaign sorted in ascending order by date when click occured.

campaignClickStatsDetails(string $cid, array $filters, integer $start, integer $limit) : array
Input parameters
  • cid - campaign ID
  • filters - selection parameters (optional). Array consisting of any of following parameters:
  • start - page number starting from which selection will be made (optional). Default value is 0.
  • limit - number of results returned in one page (optional). Default value is 1000. Maximum allowable value is 15000.
Information obtained

Array of email click statistics consisting of:

  • email - recipient email address
  • link - URL address of clicked link
  • date - date when click was made
  • device - device name (desktop, mobile, tablet)
  • browser - browser name

Examples

mgapi_campaignClickStatsDetails.php
<?php
/**
This Example shows how to campaignClickStatsDetails using the MGAPI.php class and do some basic error checking.
**/
require_once 'inc/MGAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey

$api = new MGAPI($apikey);

$cid = $campaignId;
$filters = [
	// 'linkId' => '000000',
	'link' => 'http://example.com/',
];
$start = 0;
$limit = 25;

$retval = $api->campaignClickStatsDetails($cid, $filters, $start, $limit);

header("Content-Type: text/plain");
if ($api->errorCode) {
	echo "Unable to load campaignClickStatsDetails()!";
	echo "\tCode={$api->errorCode}\n";
	echo "\tMsg={$api->errorMessage}\n";
} else {
	if (sizeof($retval) == 0) {
		echo "No stats for this campaign yet!\n";
	} else {
		foreach ($retval as $detail) {
			echo "Email = {$detail['email']}\n";
			echo "Link = {$detail['link']}\n";
			echo "Date = {$detail['date']}\n";
			echo "Device = {$detail['device']}\n";
			echo "Browser = {$detail['browser']}\n";
			echo "\n";
		}
	}
}

© 2010-2018 Mailigen. All rights reserved.