function acquia_lift_set_option_for_audience in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 acquia_lift.admin.inc \acquia_lift_set_option_for_audience()
Assigns an option to a target audience.
Parameters
$agent: A stdClass object representing the agent.
$option_id: The option ID
$audience: The name of hte targeting audience to assign the option to.
Throws
\PersonalizeException
1 call to acquia_lift_set_option_for_audience()
- acquia_lift_update_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 1552 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function acquia_lift_set_option_for_audience($agent, $option_id, $audience) {
$option_set = acquia_lift_get_option_set_for_targeting($agent->machine_name);
if (isset($option_set->targeting[$audience])) {
// If there was a test assigned to this audience, remove it.
if (isset($option_set->targeting[$audience]['osid'])) {
unset($option_set->targeting[$audience]['osid']);
}
$option_set->targeting[$audience]['option_id'] = $option_id;
personalize_option_set_save($option_set);
}
}