You are here

function ga_push_add_legacy_params in GA Push 7

Same name and namespace in other branches
  1. 8 ga_push.module \ga_push_add_legacy_params()

Maps old method keys to the new ones. This function is for legacy compatibility and will be removed on next releases.

1 call to ga_push_add_legacy_params()
ga_push_add in ./ga_push.module
Add a new google analytics tracking push.

File

./ga_push.module, line 227
Drupal Module: GA Push.

Code

function ga_push_add_legacy_params($push, $type) {
  switch ($type) {
    case GA_PUSH_TYPE_ECOMMERCE:

      // Transaction:
      $push_legacy_trans_map = array(
        'order_id' => 'id',
        'total' => 'revenue',
        'total_shipping' => 'shipping',
        'total_tax' => 'tax',
      );
      $push['trans'] = ga_push_push_data_mapper($push_legacy_trans_map, $push['trans']);

      // Items:
      $push_legacy_items_map = array(
        'order_id' => 'id',
      );
      foreach ($push['items'] as $key => $value) {
        $push['items'][$key] = ga_push_push_data_mapper($push_legacy_items_map, $value);
      }
      break;
    default:
      $push_legacy_map = array(
        // Event:
        'category' => 'eventCategory',
        'action' => 'eventAction',
        'label' => 'eventLabel',
        'value' => 'eventValue',
        'non-interaction' => 'nonInteraction',
      );

      // Mapping.
      $push = ga_push_push_data_mapper($push_legacy_map, $push);
  }
  return $push;
}