Skip to content

Latest commit



83 lines (63 loc) · 2.62 KB

File metadata and controls

83 lines (63 loc) · 2.62 KB

REST API: GET clicks (Marketing Suite)

Each emailing is tracked, which allows Copernica to provide you with emailing statistics. Clicks are one of these statistics. You can retrieve all clicks for an account by sending an HTTP GET call to the following URL:


The parameters for this method can be set to retrieve the statistics from a certain period and to only receive unique clicks. The latter means that only one click per destination per link will be counted. The following optional parameters are available:

  • begintime: The timestamp after which the clicks must have occurred (YYYY-MM-DD HH:MM:SS format).
  • endtime: The timestamp before which the clicks must have occurred (YYYY-MM-DD HH:MM:SS format).
  • unique: Boolean parameter that when set to true only retrieves unique clicks. By default all clicks are returned.

Returned fields

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

  • ID: The ID of the click.
  • mailing: The ID of the mailing.
  • link: The link that was clicked.
  • timestamp: Timestamp of the click.
  • ip: The IP where the click occurred from.
  • useragent: User agent string of the machine used to click.
  • destination: The ID of the destination that clicked the link.
  • profile: The ID of the profile that clicked the link.
  • subprofile: The ID of the subprofile that clicked the link.

JSON example

A single click might look something like this:

   "timestamp":"2014-10-14 11:33:22",
   "useragent":"Mozilla\/5.0 (Ubuntu; X11; Linux x86_64; rv:8.0) Gecko\/20100101 Firefox\/8.0",

PHP example

This script demonstrates how to use this API method:

// dependencies

// retrieve only unique clicks
$data = array(
    'unique'    =>  true

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

// execute the call
print_r($api->get("ms/clicks", $data));

This example requires the REST API class.

More information