You are here

function hook_hotjar_access in Hotjar 8.2

Same name and namespace in other branches
  1. 8 hotjar.api.php \hook_hotjar_access()
  2. 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

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();
}