You are here

function analytics_page_build in Analytics 7

Implements hook_page_build().

File

./analytics.module, line 58

Code

function analytics_page_build(&$page) {
  $added = FALSE;
  if (!variable_get('analytics_disable_page_build', FALSE)) {
    $context = array(
      'page' => $page,
      'path' => current_path(),
      'account' => $GLOBALS['user'],
    );
    if ($output = analytics_get_output($context)) {
      $page += array(
        'page_bottom' => array(),
      );
      $page['page_bottom'] += $output;
      $added = TRUE;
    }
  }
  if ($added && variable_get('analytics_privacy_dnt', TRUE)) {
    drupal_add_js(drupal_get_path('module', 'analytics') . '/analytics.js', array(
      'every_page' => TRUE,
      'weight' => -100,
    ));
  }
}