You are here

function _googleanalytics_visibility_user in Google Analytics 6.3

Same name and namespace in other branches
  1. 5 googleanalytics.module \_googleanalytics_visibility_user()
  2. 6.4 googleanalytics.module \_googleanalytics_visibility_user()
  3. 6 googleanalytics.module \_googleanalytics_visibility_user()
  4. 6.2 googleanalytics.module \_googleanalytics_visibility_user()
  5. 7.2 googleanalytics.module \_googleanalytics_visibility_user()
  6. 7 googleanalytics.module \_googleanalytics_visibility_user()

Tracking visibility check for an user object.

Parameters

$account: A user object containing an array of roles to check.

Return value

boolean A decision on if the current user is being tracked by Google Analytics.

2 calls to _googleanalytics_visibility_user()
googleanalytics_footer in ./googleanalytics.module
Implementation of hook_footer() to insert JavaScript at the end of the page.
googleanalytics_init in ./googleanalytics.module
Implementation of hook_init().

File

./googleanalytics.module, line 449
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_user($account) {
  $enabled = FALSE;

  // Is current user a member of a role that should be tracked?
  if (_googleanalytics_visibility_header($account) && _googleanalytics_visibility_roles($account)) {

    // Use the user's block visibility setting, if necessary.
    if (($custom = variable_get('googleanalytics_custom', 0)) != 0) {
      if ($account->uid && isset($account->googleanalytics['custom'])) {
        $enabled = $account->googleanalytics['custom'];
      }
      else {
        $enabled = $custom == 1;
      }
    }
    else {
      $enabled = TRUE;
    }
  }
  return $enabled;
}