function acquia_lift_profiles_visitor_actions_page_build in Acquia Lift Connector 7.2
Same name and namespace in other branches
- 7 acquia_lift_profiles/acquia_lift_profiles.module \acquia_lift_profiles_visitor_actions_page_build()
Implements hook_visitor_actions_page_build().
File
- acquia_lift_profiles/
acquia_lift_profiles.module, line 348 - acquia_lift_profiles.module Provides Acquia Lift Profiles integration.
Code
function acquia_lift_profiles_visitor_actions_page_build(&$page, $actions) {
// Retrieving engagement scores.
$lift_event_values = variable_get('acquia_lift_profiles_lift_event_values', array());
$engagement_scores = array();
$global_values = array();
foreach ($actions as $machine_name) {
$action_values = isset($lift_event_values[$machine_name]) ? $lift_event_values[$machine_name] : array();
$engagement_scores[$machine_name] = isset($action_values['engagement_score']) ? (int) $action_values['engagement_score'] : ACQUIA_LIFT_PROFILES_ENGAGEMENT_SCORE_DEFAULT;
$global_values[$machine_name] = isset($action_values['global_value']) ? (int) $action_values['global_value'] : ACQUIA_LIFT_PROFILES_GLOBAL_VALUE_DEFAULT;
}
// Add info about client-side actions to Drupal.settings so that our client-
// side action listener can process them.
if (!empty($actions)) {
$page['page_top']['acquia_lift_profiles_actions'] = array(
'#attached' => array(
'js' => array(
array(
'data' => array(
'acquia_lift_profiles' => array(
'tracked_actions' => $actions,
'engagement_scores' => $engagement_scores,
'global_values' => $global_values,
),
),
'type' => 'setting',
),
),
),
);
}
}