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 link details, including the number of unique contacts that clicked each link in the email campaign activity. To include link details for links that were not clicked in the response results, set the no_clicks query parameter to true. For example, this GET call to /reports/email_reports/{campaign_activity_id}/links?no_clicks=false returns links that were and were not clicked:

{
  "campaign_activity_id": "8892baf9-970a-4de6-8400-fa4ec461986d",
  "link_click_counts": [
    {
      "link_url": "https://www.1constantcontact.com/",
      "url_id": "1100577727123",
      "link_tag": "google-link-1",
      "list_id": "3377aefd-970a-4de6-8400-ab4ec591625f",
      "list_action": "add",
      "unique_clicks": 99
    },
    {
      "link_url": "https://www.2constantcontact.com/",
      "url_id": "1100577727421",
      "unique_clicks": 0
    }
  ]
}

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": []
}

Properties

  • link_url: The URL of a link in an email campaign activity. This URL is not normalized and appears the same as the URL in the email campaign activity. For example: https://www.constantcontact.com/.

  • url_id: The ID for a unique link URL in an email campaign activity. For example 1100577727321.

  • link_tag: Link tags are not currently available in email campaigns. By default, this method combines results for duplicate link URLs. Link tags will allow users to get a separate link click report for each unique link_tag value they use, even if URLs are not unique. For example: google-link-1.

  • list_id: If the link uses the click segmentation feature, this property contains the contact list linked with the list_action property. For example: 3377aefd-970a-4de6-8400-ab4ec491624c.

  • list_action: If the link uses the click segmentation feature, this property contains the action that contacts trigger when they click the link. Currently the only available action is add, which adds contacts that click the link to a contact list.

  • unique_clicks: The number of unique contacts that clicked the link. If the no_clicks query parameter is set to true, any links with no clicks display in the results with unique_clicks = 0.

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.

To include link details for links that were not clicked in the response results, set the no_clicks query parameter to true. The default is false.

Example Get Email Links Report Request

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!