Get a report on the number of contacts that clicked each unique link in an email campaign activity.

Make a GET call to the /reports/email_reports/{campaign_activity_id}/links endpoint to return a report on how many unique contacts clicked each link in an email campaign activity. This report also includes the type of action that contacts trigger when they click a link.

You can return reporting data for primary_email and resend role email campaign activities. If you have not sent the email campaign activity to contacts, this method returns a 200 response code and an empty array for link_clink_counts:

{
    "campaign_activity_id": "6cc0d637-cf3d-4ac6-aad7-21567698eb38",
    "link_click_counts": []
}

You can confirm that Constant Contact successfully sent an email campaign activity by making a GET call to /emails/activities/{campaign_activity_id} and checking that the email campaign activity is in Done status. For more information, see the Get an Email Campaign Activity topic.

Parameters

This method requires the campaign_activity_id URL parameter. Use the campaign_activity_id parameter to specify which email campaign activity you want to use to return an email links report.

Example Get Email Links Report Call

This example GET call returns an email link report for each unique link URL in an email campaign activity. The following example response body is for an email campaign activity that contains two unique link URLs. The unique_clicks response body property contains the number of unique contacts that clicked each link in the email campaign activity.

GET https://api.cc.email/v3/reports/email_reports/1ead98be-dfa0-4e04-81f7-5f1534d42e9c/links

Endpoint Requirements

User privileges: ui:campaign:metrics

Authorization scopes: campaign_data

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/reports/email_reports/1ead98be-dfa2-4e04-51f7-5f1564d42e9c/links');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Postman-Token' => '17572acf-2b4e-4526-b82d-ea620f3223a5',
  'cache-control' => 'no-cache',
  'Authorization' => 'Bearer {access_token}'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cc.email/v3/reports/email_reports/1ead98be-dfa2-4e04-51f7-5f1564d42e9c/links")
  .get()
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("cache-control", "no-cache")
  .addHeader("Postman-Token", "822fbaf2-f339-470e-aa39-cd692f79ae93")
  .build();

Response response = client.newCall(request).execute();
curl -X GET \
  https://api.cc.email/v3/reports/email_reports/1ead98be-dfa2-4e04-51f7-5f1564d42e9c/links \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Postman-Token: c02900ca-261a-4831-bfac-1064078da502' \
  -H 'cache-control: no-cache'

Response

{
    "campaign_activity_id": "1ead98be-dfa0-4e04-81f7-5f1534d42e9c",
    "link_click_counts": [
        {
            "link_url": "http://constantcontact.com/",
            "url_id": "555617788878",
            "unique_clicks": 17,
            "list_action": "add",
            "list_id": "f4ab800a-5adf-11e9-ba6a-fa163e6b01c1"
        },
        {
            "link_url": "https://v3.developer.constantcontact.com/",
            "url_id": "1100577727321",
            "unique_clicks": 11
        }
    ]
}

Try it!