REST API v4: GET clicks (Publisher 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:$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:

   "timestamp":"2010-11-03 15:07:33",
   "useragent":"Firefox 3.6, WinXP",

PHP example

This script demonstrates how to use this API method:

// dependencies

// 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("publisher/destination/{$emailingDestinationID}/clicks/", $parameters));

This example requires the REST API class.

More information