You are here

hotjar.api.php in Hotjar 7

Same filename and directory in other branches
  1. 8.2 hotjar.api.php
  2. 8 hotjar.api.php

Hooks provided by the Hotjar module.

File

hotjar.api.php
View source
<?php

/**
 * @file
 * Hooks provided by the Hotjar module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Control access to a Hotjar tracking code.
 *
 * Modules may implement this hook if they want to disable tracking for some
 * reasons.
 *
 * @return bool|null
 *   - HOTJAR_ACCESS_ALLOW: If tracking is allowed.
 *   - HOTJAR_ACCESS_DENY: If tracking is disabled.
 *   - HOTJAR_ACCESS_IGNORE: If tracking check is
 *
 * @ingroup node_access
 */
function hook_hotjar_access() {

  // Disable for frontpage.
  return current_path() == '<front>' ? HOTJAR_ACCESS_DENY : HOTJAR_ACCESS_ALLOW;
}

/**
 * Alter results of Hotjar access check results.
 */
function hook_hotjar_access_alter(&$results) {

  // Force disable for frontpage.
  $results['my_module_check'] = current_path() == '<front>' ? HOTJAR_ACCESS_DENY : HOTJAR_ACCESS_ALLOW;
}

/**
 * @} End of "addtogroup hooks".
 */

Functions

Namesort descending Description
hook_hotjar_access Control access to a Hotjar tracking code.
hook_hotjar_access_alter Alter results of Hotjar access check results.