public function AcquiaLiftAPI::saveCampaign in Acquia Lift Connector 7.2
Saves a campaign to Lift.
Parameters
$name: The name of the campaign. Should conform to Lift naming rules.
$title: A friendly name for the campaign.
$decision_name: The name of the decision for this campaign.
$goals: An array of goals for this campaign.
$mab: Whether to use the MAB algorithm.
$control: The control fraction to use.
$explore: The explore fraction to use.
File
- includes/
AcquiaLiftAPI.inc, line 378
Class
Code
public function saveCampaign($name, $title, $decision_name, $goals, $mab = FALSE, $control = 0, $explore = 0.2) {
$vars = array(
'agent' => $name,
);
$success_msg = 'The personalization {agent} was pushed to Acquia Lift';
$fail_msg = 'The personalization {agent} could not be pushed to Acquia Lift';
$path = "campaigns";
$url = $this
->generateEndpoint($path);
$agent = array(
'id' => $name,
'title' => $title,
'algorithm' => 'mab',
'decision_sets' => array(
$decision_name,
),
'goals' => $goals,
// this manages the traffic fraction. We want to see the control variation
// in 10% (configurable) of the times so the other 90% are the ones who
// participate. This means we have to send 1-0.1 = 0.9 to the traffic
// fraction variable
'traffic_fraction' => 1 - $control,
// Non-MAB is equivalent to 100% explore mode.
'explore_fraction' => $mab ? $explore : 1,
);
$this
->makePostRequest($url, array(), $agent, $success_msg, $fail_msg, $vars);
}