You are here

function acquia_lift_profiles_put_action in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift_profiles/acquia_lift_profiles.module \acquia_lift_profiles_put_action()

Calls the Acquia Lift Profiles API to create/update an event corresponding to a Visitor Actions action.

Parameters

$action_name: The name of the action to save to Acquia Lift Profiles.

string $label: The human-readable name of the action. If not provided it will be looked up.

array $errors: An array, passed by reference, to add any errors to.

3 calls to acquia_lift_profiles_put_action()
acquia_lift_profiles_batch_sync_action in acquia_lift_profiles/acquia_lift_profiles.batch.inc
Batch API callback to sync an action to Lift web
acquia_lift_profiles_update_7002 in acquia_lift_profiles/acquia_lift_profiles.install
Ensure all defined visitor actions are sync'd to Lift Web.
acquia_lift_profiles_visitor_actions_save_action in acquia_lift_profiles/acquia_lift_profiles.module
Implements hook_visitor_actions_save_action().

File

acquia_lift_profiles/acquia_lift_profiles.module, line 436
acquia_lift_profiles.module Provides Acquia Lift Profiles integration.

Code

function acquia_lift_profiles_put_action($action_name, $label, &$errors = array()) {
  try {
    $acquia_lift_profiles_api = ALProfilesAPI::getInstance(variable_get('acquia_lift_profiles_account_name', ''), variable_get('acquia_lift_profiles_site_name', ''), variable_get('acquia_lift_profiles_api_url', ''));
    $acquia_lift_profiles_api
      ->saveEvent($action_name, $label);
    watchdog('acquia_lift_profiles', 'Synchronized the action @action to Acquia Lift Web.', array(
      '@action' => $action_name,
    ), WATCHDOG_INFO);
  } catch (ALProfilesException $e) {
    watchdog('acquia_lift_profiles', 'There was a problem saving the action @action to Acquia Lift Profiles. Please try again later.', array(
      '@action' => $action_name,
    ), WATCHDOG_ERROR);
    $errors[] = $e
      ->getMessage();
  }
}