CampaignMonitor::getCampaignClicks PHP Метод

getCampaignClicks() публичный Метод

Contains a paged result representing all subscribers who clicked a link in the email for a given campaign, including the date/time and IP address they clicked the campaign from. The result set is organized by URL.
public getCampaignClicks ( string $campaignId, int[optional] $timestamp = null, int[optional] $page = 1, int[optional] $pageSize = 1000, string[optional] $orderField = 'date', string[optional] $orderDirection = 'asc' ) : array
$campaignId string The ID of the campaign you want data for.
$timestamp int[optional]
$page int[optional]
$pageSize int[optional]
$orderField string[optional]
$orderDirection string[optional]
Результат array
    public function getCampaignClicks($campaignId, $timestamp = null, $page = 1, $pageSize = 1000, $orderField = 'date', $orderDirection = 'asc')
    {
        // set parameters
        $parameters['date'] = (string) date('Y-m-d', $timestamp);
        $parameters['page'] = (int) $page;
        $parameters['pagesize'] = (int) $pageSize;
        $parameters['orderfield'] = (string) $orderField;
        $parameters['orderdirection'] = (string) $orderDirection;
        // make the call
        $records = (array) $this->doCall('campaigns/' . $campaignId . '/clicks', $parameters);
        // stop here if no records were set
        if (empty($records['Results'])) {
            return array();
        }
        // reserve variables
        $results = array();
        $links = array();
        // loop the records
        foreach ($records['Results'] as $key => $record) {
            // build record for the clicker
            $result = array();
            $result['email'] = $record['EmailAddress'];
            $result['url'] = preg_replace('/(\\?|&)utm_(.*)/is', '', $record['URL']);
            $result['list_id'] = $record['ListID'];
            $result['date'] = $record['Date'];
            $result['ip'] = $record['IPAddress'];
            // organise the result set based on the clicked link
            $results[$result['url']][] = $result;
        }
        // return the records
        return $results;
    }