Ability to manipulate $header and $footer from within the omniture_variables hook.
strikeink - September 9, 2009 - 21:39
| Project: | Omniture Integration |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
On line 122 of omniture.module, I added $header and $footer as follows:
if ($omniture_hooked_vars = module_invoke_all('omniture_variables', $main, $header, $footer)) {Now I am able to append, prepend and manipulate the $header and $footer values as needed from within my custom method, like so:
function myhelper_omniture_variables($main, $header, $footer) {
$data = array();
// Add the Omniture account variable that's been abstracted from Omniture's JS code to the beginning of $header, if it exists.
// Note: I added 'omniture_account' as a variable in this module since I've removed it from the s_code.js file.
if ($s_account = variable_get('omniture_account', false)) {
$data['header'] = '<script type="text/javascript" language="JavaScript">' . PHP_EOL
. 'var s_account = "' . $s_account . '";' . PHP_EOL
. '</script>' . PHP_EOL
. $header;
}
// Add some more useful code to the end of $header.
$data['header'] .= 'more useful code';
// Add some useful code to the beginning of $footer as well as the end of $footer.
$data['footer'] = 'useful code ' . PHP_EOL . $footer . PHP_EOL . ' more useful code at the end';
return $data;
}| Attachment | Size |
|---|---|
| omniture.module.patch | 517 bytes |

#1
I do not understand the need for this patch, as it stands the module kicks out the header, omniture_variables, then footer in that order, so why would you not just stick your omniture account variable inside the main set of variables.
If you know of a reason why the header and footer would need to be appended to please can you state this reason.