function ga_stats_collect_data in Google Analytics Statistics 7
Same name and namespace in other branches
- 7.2 includes/ga.inc \ga_stats_collect_data()
 
Retrieve data for all configured metrics and time-frames.
Parameters
gapi $client:
Return value
array
1 call to ga_stats_collect_data()
- _ga_stats_update_counts in includes/
ga.inc  - Goes through sources and metrics and updates databases
 
File
- includes/
ga.inc, line 42  
Code
function ga_stats_collect_data($client) {
  $data = array();
  $current = time();
  foreach (ga_stats_ga_metrics() as $metric => $title) {
    foreach (ga_stats_ga_timeframes() as $key => $timeframe) {
      $filter = isset($timeframe['filter']) ? $timeframe['filter'] : NULL;
      $results = ga_stats_ga_data($client, $metric, $current - $timeframe['secsToSub'], $current);
      $data = array_merge($data, ga_stats_transform_data($results, $metric, $key));
    }
  }
  return $data;
}