public function VisiblityTracker::getUserVisibilty in Google Analytics 4.x
Tracking visibility check for an user object.
Parameters
object $account: A user object containing an array of roles to check.
Return value
bool TRUE if the current user is being tracked by Google Analytics, otherwise FALSE.
File
- src/
Helpers/ VisiblityTracker.php, line 72
Class
- VisiblityTracker
- Defines the Path Matcher class.
Namespace
Drupal\google_analytics\HelpersCode
public function getUserVisibilty($account) {
$enabled = FALSE;
// Is current user a member of a role that should be tracked?
if ($this
->getVisibilityRoles($account)) {
// Use the user's block visibility setting, if necessary.
if (($visibility_user_account_mode = $this->config
->get('visibility.user_account_mode')) != 0) {
$user_data_google_analytics = $this->userData
->get('google_analytics', $account
->id());
if ($account
->id() && isset($user_data_google_analytics['user_account_users'])) {
$enabled = $user_data_google_analytics['user_account_users'];
}
else {
$enabled = $visibility_user_account_mode == 1;
}
}
else {
$enabled = TRUE;
}
}
return $enabled;
}