REST API v4: GET clicks (HTML mailing destination)

You can retrieve the statistics per emailing destination just like you would retrieve the statistics of a mailing. You can retrieve the clicks for an emailing destination by sending an HTTP GET call to the following URL:

https://api.copernica.com/v4/html/destination/$id/clicks

Where the $id should be replaced with the ID of the emailing destination. This method also support the use of the fields parameter for the timestamp field.

Returned fields

The method returns a JSON object with several clicks under the 'data' field. For each click the following information is available:

  • ID: ID of the click.
  • link_id: ID of the link that was clicked.
  • link: The link that was clicked.
  • link_title: The title of the link that was clicked.
  • timestamp: The timestamp of the click.
  • ip: The IP where the click came from.
  • useragent: The user agent string of the clicker.
  • referer: The referer of the clicker.
  • emailing: The ID of the emailing where the click came from.
  • destination: The destination where the click came from.
  • profile: The profile where the click came from.
  • subprofile: The subprofile where the click came from (if applicable).

JSON example

The JSON for a single click looks somewhat like this:

{  
   "ID":"19431",
   "link_id":"3145",
   "link":"{webversion}",
   "link_title":"",
   "timestamp":"2010-11-03 15:07:33",
   "ip":"0.0.0.0",
   "useragent":"Firefox 3.6, WinXP",
   "referer":null,
   "emailing":"1914",
   "destination":"823456",
   "profile":"2290961",
   "subprofile":null
}

PHP example

This script demonstrates how to use this API method:

// dependencies
require_once('CopernicaRestAPI.php');

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);

// set the period
$parameters = array(
    'fields'    =>  array('timestamp>2019-01-01', 'timestamp<2019-02-01')
);

// execute the call
print_r($api->get("html/destination/{$emailingDestinationID}/clicks/", $parameters));

This example requires the REST API class.

More information