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

Make a PUT call to the emails/activities/{campaign_activity_id}/abtest endpoint to update A/B test details for a primary email campaign activity that has a current status of DRAFT. You must include all the following A/B test properties in the request body, then choose which properties you want to update:

  • 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 to participate 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 the winner is determined, 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.

Authorization Requirements

User privileges: campaign:write

Authorization scopes: campaign_data

Parameters

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

Example Get Email Campaign Activity A/B Test

PUT 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/0c53584f-113e-4b4c-b137-2d3a9e623919/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 => 'PUT',
  CURLOPT_POSTFIELDS =>' {
     "test_size": 20,
    "alternative_subject": "Reminder: Big Sales Coming Soon!",
    "winner_wait_duration": 48
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/json',
    'Authorization: Bearer {access_token}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, " {\n     \"test_size\": 20,\n    \"alternative_subject\": \"Reminder: Big Sale Coming Soon!\",\n    \"winner_wait_duration\": 48\n}");
Request request = new Request.Builder()
  .url("https://api.cc.email/v3/emails/activities/0c53584f-113e-4b4c-b137-2d3a9e623919/abtest")
  .method("PUT", body)
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .build();
Response response = client.newCall(request).execute();
curl --location --request PUT 'https://api.cc.email/v3/emails/activities/0c53584f-113e-4b4c-b137-2d3a9e623919/abtest' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access_token}' \
--data-raw ' {
     "test_size": 20,
    "alternative_subject": "Reminder: Big Sales Coming Soon!",
    "winner_wait_duration": 48
}'

Response

{
    "alternative_subject": "Reminder: Big Sale Coming Soon!",
    "test_size": 20,
    "winner_wait_duration": 48
}

Try it!