function hook_datalayer_alter in dataLayer 8
Same name and namespace in other branches
- 7 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_get_data_from_page in ./
datalayer.module - Add data for output.
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']);
}