-
Notifications
You must be signed in to change notification settings - Fork 1
/
google_tag.api.php
43 lines (39 loc) · 1.09 KB
/
google_tag.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @file
* Documents hooks provided by this module.
*
* @author Jim Berry ("solotandem", http://drupal.org/user/240748)
*/
/**
* @addtogroup hooks
* @{
*/
/**
* 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.
*
* @param bool $satisfied
* The snippet insertion state.
*/
function hook_google_tag_insert_alter(&$satisfied) {
// Do something to the state.
$state = !$state;
}
/**
* Alter the snippets to be inserted on a page response.
*
* This hook allows other modules to alter the snippets to be inserted based on
* custom settings not defined by this module.
*
* @param array $snippets
* Associative array of snippets keyed by type: script, noscript and
* data_layer.
*/
function hook_google_tag_snippets_alter(&$snippets) {
// Do something to the script snippet.
$snippets['script'] = str_replace('insertBefore', 'insertAfter', $snippets['script']);
}