function google_analytics_cron in Google Analytics 8.2
Same name and namespace in other branches
- 8.3 google_analytics.module \google_analytics_cron()
- 4.x google_analytics.module \google_analytics_cron()
Implements hook_cron().
File
- ./
google_analytics.module, line 441 - Drupal Module: Google Analytics.
Code
function google_analytics_cron() {
$config = \Drupal::config('google_analytics.settings');
$request_time = \Drupal::time()
->getRequestTime();
// Regenerate the tracking code file every day.
if ($request_time - \Drupal::state()
->get('google_analytics.last_cache') >= 86400 && $config
->get('cache')) {
_google_analytics_cache('https://www.google-analytics.com/analytics.js', TRUE);
\Drupal::state()
->set('google_analytics.last_cache', $request_time);
}
}