You are here

function _googleanalytics_visibility_header in Google Analytics 7

Same name and namespace in other branches
  1. 6.4 googleanalytics.module \_googleanalytics_visibility_header()
  2. 6.3 googleanalytics.module \_googleanalytics_visibility_header()
  3. 7.2 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 640
Drupal Module: Google Analytics

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;
}