You are here

function _getclicky_track in Clicky - Web Analytics in Real Time 5

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 getClicky

1 call to _getclicky_track()
getclicky_footer in ./getclicky.module
Implementation of hook_footer() to insert Javascript at the end of the page

File

./getclicky.module, line 136

Code

function _getclicky_track($account) {

  // By default we don't track users.
  $track = FALSE;
  foreach (array_keys($account->roles) as $role) {

    // Add the tracking code if user is member of one role that should be tracked.
    if (variable_get('getclicky_track_' . $role, FALSE)) {
      $track = TRUE;
    }
  }

  // Handle behavior for administrative user 1.
  if ($account->uid == 1 && variable_get('getclicky_track__user1', FALSE)) {

    // Enable tracking of user 1 if tracking for "authenticated user" is disabled.
    $track = TRUE;
  }
  elseif ($account->uid == 1 && !variable_get('getclicky_track__user1', FALSE)) {

    // User 1 is a member of "authenticated user". Disable user tracking
    // if user 1 shouldn't, but "authenticated user" should be tracked.
    $track = FALSE;
  }
  return $track;
}