You are here

function hook_google_tag_insert_alter in GoogleTagManager 8

Same name and namespace in other branches
  1. 7.2 google_tag.api.php \hook_google_tag_insert_alter()
  2. 7 google_tag.api.php \hook_google_tag_insert_alter()

Alter the state of snippet insertion on the current page response.

This hook allows other modules to alter the state of snippet insertion based on custom conditions that cannot be defined by the status, path, and role conditions provided by this module.

Parameters

bool $satisfied: The snippet insertion state.

\Drupal\google_tag\Entity\Container $container: The associated container object.

1 invocation of hook_google_tag_insert_alter()
Container::insertSnippet in src/Entity/Container.php
Determines whether to insert the snippet on the response.

File

./google_tag.api.php, line 29
Hooks provided by this module.

Code

function hook_google_tag_insert_alter(&$satisfied, Container $container) {

  // Do something to the state.
  $state = !$state;
}