You are here

function _google_analytics_counter_path_report in Google Analytics Counter 7

Same name and namespace in other branches
  1. 6.2 google_analytics_counter.module \_google_analytics_counter_path_report()
  2. 6 google_analytics_counter.module \_google_analytics_counter_path_report()
1 call to _google_analytics_counter_path_report()
google_analytics_counter_get_sum_per_path in ./google_analytics_counter.module
@todo Please document this function.

File

./google_analytics_counter.module, line 485

Code

function _google_analytics_counter_path_report($request, $path = NULL, $group_by = 'date') {
  $data = array();
  if ($path == 'ga_api_all_paths') {
    $cachehere = array(
      'cid' => 'google_analytics_counter_all',
      'expire' => google_analytics_reports_cache_time(),
      'refresh' => FALSE,
    );
    $new_data = google_analytics_api_report_data($request, $cachehere);
    $data = array_values((array) $new_data->results);

    // Make an array from inside the object.
  }
  else {
    foreach (_google_analytics_counter_path_filter($path) as $filter) {
      $request['filters'] = $filter;
      $cachehere = array(
        'cid' => 'google_analytics_counter_' . md5(serialize($request)),
        'expire' => google_analytics_reports_cache_time(),
        'refresh' => FALSE,
      );
      $new_data = google_analytics_api_report_data($request, $cachehere);
      $new_data = array_values((array) $new_data->results);

      // Make an array from inside the object.
      if (@$new_data) {
        $data = array_merge($data, $new_data);
      }
    }
  }
  return $data;
}