You are here

function hook_hotjar_access_alter in Hotjar 8.2

Same name and namespace in other branches
  1. 8 hotjar.api.php \hook_hotjar_access_alter()
  2. 7 hotjar.api.php \hook_hotjar_access_alter()

Alter results of Hotjar access check results.

1 invocation of hook_hotjar_access_alter()
SnippetAccess::check in src/SnippetAccess.php
Determines whether we add tracking code to page.

File

./hotjar.api.php, line 36
Hooks provided by the Hotjar module.

Code

function hook_hotjar_access_alter(&$results) {

  // Force disable for frontpage.
  if (\Drupal::service('path.matcher')
    ->isFrontPage()) {
    $result = AccessResult::forbidden();
  }
  else {
    $result = AccessResult::neutral();
  }
  $results['my_module_check'] = $result;
}