https://<subdomain>.sendsmaily.net/api/split.php


POST method must be used for this query.


Parameters

All parameters must be URL encoded.


Parameter

Value

splits

An array of campaigns, which will be part of the A/B split test. Required. See also “Structure of the parameter splits”.

list

List or lists of subscribers the campaign is being sent to. IDs of filters in Smaily > Subscribers. Required. See also List user-made filters.

size

A percentage taken from unique subscribers, contained in lists obtained from the parameter list, which is divided equally between all the splits specified in the array of parameter splits. See an example calculation at “Finding the number of subscribers”. Required.

condition

Winning condition, which will be used to select the best-performing split. Possible values are openrate, clicks, views, unsubscribed. Default is clicks.

win_at

Due date to send out a campaign to the rest of the list with the best-performing split options. Value must be formatted as date-time (“YYYY-MM-DD HH:MM:SS”). If no value is set, wrong formatting is used of the specified date-time is in the past, query will be stopped. Required.


Structure of the parameter splits


Parameter

Value

subject

Email subject. Required. Text field.

html

Link to HTML content, which needs to be in a publicly accessible URL. Required.

text

Link to plain-text content, which needs to be in a publicly accessible URL. Required.

from

Sender From address. Required. Must be added first in Smaily > Account profile.

from_name

Sender Name. Not required. If not set, default Name will be used from Smaily > Account profile.

due

Due date of the campaign split. Value must be formatted as date-time (“YYYY-MM-DD HH:MM:SS”). If no value is set, “now” will be used with a 5-minute “grace” period, if the campaign still needs to be cancelled, which can be done in Smaily > Campaigns. Due date must not be later than parameter win_at!


Response

In addition to status code and message, field ID will be given with the response, which contains an ID of the campaign. With this parameter the statistics of the campaign can be obtained later.


Finding the number of subscribers

Let’s say that we want to test a campaign with two different subjects for link click performance on the lists “Estonian subscribers” and “Finnish subscribers”. The lists contain a total of 10 000 unique subscribers. We’ll use 20% of the lists for tests.


Number of subscribers getting the split A or B is 10 000 * 20% = 2 000.


Since the A/B split test campaign has 2 tests, number of subscribers participating in one split of the test is - 2 000 / 2 = 1 000.


Either test campaign will be sent to 1 000 random (unique) subscribers contained in the list “Estonian subscribers” or “Finnish subscribers”.


Example query:


Launching an A/B split test campaign


Query to launch an A/B split test campaign, which contains two splits. Tests will be sent to 10% of the list “Estonian subscribers”. 


$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$location = 'https://<subdomain>.sendsmaily.net/api/split.php';
$query = array(
  'splits' => array(
    array(
      'subject' => 'Head pakkumised - test (A)',
      'from' => 'info@domeen.ee',
      'html' => 'http://domeen.ee/path/to/html/content.html',
      'text' => 'http://domeen.ee/path/to/html/content.txt',
      'due' => '2014-06-18 07:00:00',
    ),
    array(
      'subject' => 'Head pakkumised - test (B)',
      'from' => 'info@domeen.ee',
      'from_name' => 'API test',
      'html' => 'http://domeen.ee/path/to/html/content.html',
      'text' => 'http://domeen.ee/path/to/html/content.txt',
      'due' => '2014-06-18 15:00:00',
    ),
  ),
  'list' => 7,
  'size' => 10,
  'win_at' => '2014-06-25 07:00:00',
);

// Query ($query) should be posted as following.
// In our example it will be taken care of by “http_build_query” function.
// splits%5B0%5D%5Bsubject%5D=Head+pakkumised+-+test+%28A%29&splits%5B0%5D%5Bfrom%5D=info%40domeen.ee&splits%5B0%5D%5Bhtml%5D=https%3A%2F%2Fwww.sendsmaily.net%2Faccount%2Flogin%2F&splits%5B0%5D%5Btext%5D=https%3A%2F%2Fwww.sendsmaily.net%2Faccount%2Flogin%2F&splits%5B0%5D%5Bdue%5D=2014-06-18+07%3A00%3A00&splits%5B1%5D%5Bsubject%5D=Head+pakkumised+-+test+%28B%29&splits%5B1%5D%5Bfrom%5D=info%40domeen.ee&splits%5B1%5D%5Bfrom_name%5D=API+test&splits%5B1%5D%5Bhtml%5D=https%3A%2F%2Fwww.sendsmaily.net%2Faccount%2Flogin%2F&splits%5B1%5D%5Btext%5D=https%3A%2F%2Fwww.sendsmaily.net%2Faccount%2Flogin%2F&splits%5B1%5D%5Bdue%5D=2014-06-20+08%3A00%3A00&list=7&size=10&win_at=2014-06-25+07%3A00%3A00

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($query));
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");

$result = curl_exec($ch);
curl_close($ch);

 

Result for a successful query:

 

{
  'code': 101,
  'message': 'OK',
  'id': 1
}

  

See also other possible results from Possible results.