REST API v4: GET impressions (HTML)

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

https://api.copernica.com/v4/html/impressions

This method also support the use of the fields parameter for the ID and timestamp field.

Returned fields

The method returns a JSON object with several impressions stored in the 'data' field. For each impression the following information is available:

  • ID: The ID of the impression.
  • timestamp: The timestamp of the impression.
  • ip: The IP from which the impression came.
  • useragent: The user agent string of the user the impression came from.
  • device: The type of device the impression came from ('desktop','tablet','mobile','unknown').
  • referer: The referer of the user the impression came from.
  • emailing: The ID of the mailing.
  • destination: The ID of the destination.
  • profile: The ID of the profile.
  • subprofile: The ID of the subprofile (if applicable).

JSON example

The JSON representation of a single impression might look somewhat like this:

{  
   "ID":"44807",
   "timestamp":"2010-07-20 14:34:32",
   "ip":"0.0.0.0",
   "useragent":"Microsoft Outlook 2007, WinXP",
   "device":"desktop",
   "referer":null,
   "emailing":"1328",
   "destination":"822758",
   "profile":"2590894",
   "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/impressions/", $parameters));

This example requires the REST API class.

More information