You are here

function _matomo_visibility_user in Matomo Analytics 7.2

Same name and namespace in other branches
  1. 8 matomo.module \_matomo_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 Matomo.

1 call to _matomo_visibility_user()
matomo_page_alter in ./matomo.module
Implements hook_page_alter() to insert JavaScript to the appropriate scope/region of the page.

File

./matomo.module, line 583
Drupal Module: Matomo

Code

function _matomo_visibility_user($account) {
  $enabled = FALSE;

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

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