You are here

function ga_stats_cron in Google Analytics Statistics 7.x

Same name and namespace in other branches
  1. 7.2 ga_stats.module \ga_stats_cron()
  2. 7 ga_stats.module \ga_stats_cron()

File

./ga_stats.module, line 55

Code

function ga_stats_cron() {
  if (!cache_get('ga_stats_data')) {
    $data = ga_stats_update_counts();

    //save the data for 10 or 30 minutes (based on whether hourly data is enabled
    $times = variable_get('ga_stats_enabled_timeframes', array(
      'today',
      'month',
    ));
    if (in_array('hour', $times)) {
      $add = 60 * 10;
    }
    else {
      $add = 60 * 30;
    }
    cache_set('ga_stats_data', $data, 'cache', time() + $add);
  }
}