function hook_datalayer_alter in dataLayer 7
Same name and namespace in other branches
- 8 datalayer.api.php \hook_datalayer_alter()
Alter the Data Layer data before it is output to the screen.
Parameters
array $data_layer: GTM data layer data for the current page.
Related topics
1 invocation of hook_datalayer_alter()
- datalayer_preprocess_html in ./
datalayer.module - Implements hook_preprocess_HOOK().
File
- ./
datalayer.api.php, line 75 - Documentation for the Data Layer module.
Code
function hook_datalayer_alter(array &$data_layer) {
// EXAMPLE:
// Set the "site" variable to return in lowercase.
$data_layer['site'] = strtolower($data_layer['site']);
}