function google_tag_insert_snippet in GoogleTagManager 7
Determines whether to insert the snippet on the response.
Return value
bool TRUE if the conditions are met; FALSE otherwise.
1 call to google_tag_insert_snippet()
- google_tag_page_build in ./
google_tag.module - Implements hook_page_build().
File
- ./
google_tag.module, line 281 - Provides primary Drupal hook implementations.
Code
function google_tag_insert_snippet() {
$id = variable_get('google_tag_container_id', '');
if (empty($id)) {
// No container ID.
return FALSE;
}
$satisfied = TRUE;
if (!_google_tag_status_check() || !_google_tag_path_check() || !_google_tag_role_check()) {
// Omit snippet if any condition is not met.
$satisfied = FALSE;
}
// Allow other modules to alter the insertion criteria.
drupal_alter('google_tag_insert', $satisfied);
$debug = variable_get('google_tag_debug_output', 0);
$debug ? drupal_set_message(t('after alter @satisfied', array(
'@satisfied' => $satisfied,
))) : '';
return $satisfied;
}