function hook_hotjar_access in Hotjar 8.2
Same name and namespace in other branches
- 8 hotjar.api.php \hook_hotjar_access()
- 7 hotjar.api.php \hook_hotjar_access()
Control access to a Hotjar tracking code.
Modules may implement this hook if they want to disable tracking for some reasons.
Return value
\Drupal\Core\Access\AccessResultInterface|bool|null
- HOTJAR_ACCESS_ALLOW: If tracking is allowed.
- HOTJAR_ACCESS_DENY: If tracking is disabled.
- HOTJAR_ACCESS_IGNORE: If tracking check is
1 invocation of hook_hotjar_access()
- SnippetAccess::check in src/
SnippetAccess.php - Determines whether we add tracking code to page.
File
- ./
hotjar.api.php, line 25 - Hooks provided by the Hotjar module.
Code
function hook_hotjar_access() {
// Disable for frontpage.
if (\Drupal::service('path.matcher')
->isFrontPage()) {
return AccessResult::forbidden();
}
return AccessResult::neutral();
}