You are here

function _googleanalytics_visibility_header in Google Analytics 6.3

Same name and namespace in other branches
  1. 6.4 googleanalytics.module \_googleanalytics_visibility_header()
  2. 7.2 googleanalytics.module \_googleanalytics_visibility_header()
  3. 7 googleanalytics.module \_googleanalytics_visibility_header()

Based on headers send by clients this function returns TRUE if GA code should be added to the current page and otherwise FALSE.

1 call to _googleanalytics_visibility_header()
_googleanalytics_visibility_user in ./googleanalytics.module
Tracking visibility check for an user object.

File

./googleanalytics.module, line 550
Drupal Module: GoogleAnalytics Adds the required Javascript to the bottom of all your Drupal pages to allow tracking by the Google Analytics statistics package.

Code

function _googleanalytics_visibility_header($account) {
  if (($account->uid || variable_get('cache', 0) == 0) && variable_get('googleanalytics_privacy_donottrack', 1) && !empty($_SERVER['HTTP_DNT'])) {

    // Disable tracking if caching is disabled or a visitors is logged in and
    // have opted out from tracking via DNT (Do-Not-Track) header.
    return FALSE;
  }
  return TRUE;
}