function acquia_lift_save_nested_test_options in Acquia Lift Connector 7.2
Saves the current test options on each nested test.
Parameters
stdClass $parent_agent: The parent targeting agent that may contain nested tests to update.
1 call to acquia_lift_save_nested_test_options()
- acquia_lift_implement_targeting in ./
acquia_lift.admin.inc - Takes whatever is in the 'lift_targeting' data property and converts it into the required campaign structure (including nested tests where needed).
File
- ./
acquia_lift.admin.inc, line 1994 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function acquia_lift_save_nested_test_options($parent_agent) {
$tests = acquia_lift_get_nested_tests($parent_agent);
if (empty($tests)) {
return;
}
$explore_rate = 100;
$decision_style = 'random';
if (isset($parent_agent->data['decision_style']) && $parent_agent->data['decision_style'] == 'adaptive') {
$decision_style = 'adaptive';
$explore_rate = isset($parent_agent->data['explore_rate']) ? $parent_agent->data['explore_rate'] : 20;
}
$agent_data = array(
'control_rate' => isset($parent_agent->data['control_rate']) ? $parent_agent->data['control_rate'] : 0,
'explore_rate' => $explore_rate,
'decision_style' => $decision_style,
);
foreach ($tests as $test) {
$nested_agent = personalize_agent_load($test);
$nested_agent->data = array_merge($nested_agent->data, $agent_data);
personalize_agent_save($nested_agent);
}
}