Get A/B test details for a primary email campaign activity.

Make a GET call to the emails/activities/{campaign_activity_id}/abtest endpoint to get A/B test details for a primary email campaign activity.

The following example shows the A/B test details returned in the response body:

{
    "alternative_subject": "{the alternate subject line to use}",
    "test_size": 10,
    "winner_wait_duration": 6
}
  • alternative_subject: The alternate email subject line to use for A/B testing. Currently, A/B tests support subject line only.

  • test_size: The percentage of contact recipients in the A/B Test. For example, if the value is 30, then 30% of contacts will receive the email campaign with subject line A, and 30% of contacts will receive the email campaign with subject line B. Valid values include 5 to 50 percent, inclusively.

  • winner_wait_duration: The number of hours Constant Contact waits after the A/B test is sent before determining the winning subject line. The winner is the subject line with the highest number of contact opens. After determining the winner, Constant Contact automatically sends the email campaign with the winning subject line to all the remaining contacts that did not participate in the A/B test.

To schedule a draft email campaign A/B test, make a POST call to /emails/activities/{campaign_activity_id}/schedules. This method requires campaign send user privileges.

A/B test endpoints and methods that are currently available include:

  • DELETE: To revert the campaign type from AB_Test to NEWSLETTER and the type_code from 57 to 10, make a DELETE call to emails/activities/{campaign_activity_id}/abtest.

Authorization Requirements

User privileges: campaign:read

Authorization scopes: campaign_data

Parameters

Use the campaign_activity_id URL parameter to get A/B test details for a primary email campaign activity.

Example Get Email Campaign Activity A/B Test

GET https://api.cc.email/v3/emails/activities/{campaign_activity_id}/abtest

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.cc.email/v3/emails/activities/b6d041e2-8450-409a-acfb-e858c260f4f5/abtest',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {access_token}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.cc.email/v3/emails/activities/b6d041e2-8450-409a-acfb-e858c260f4f5/abtest")
  .method("GET", null)
  .addHeader("Authorization", "Bearer {access_token}")
  .build();
Response response = client.newCall(request).execute();
curl --location --request GET 'https://api.cc.email/v3/emails/activities/b6d041e2-8450-409a-acfb-e858c260f4f5/abtest' \
--header 'Authorization: Bearer {access_token}'

Response

{
    "alternative_subject": "Biggest Sale of the Year Coming Soon!",
    "test_size": 5,
    "winner_wait_duration": 6
}

Try it!