Posted by jwhat on September 9, 2009 at 9:39pm
Jump to:
| Project: | Omniture Integration |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
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 |
Comments
#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.
#2
In this specific case, s_account is referenced in s_code.js, therefore it needs to exist before the JS include.
I find it useful to have full control over $header and $footer despite the simple need for it in this case.
#3
#4
Would you not just have your own module that set the relevant variables before the omniture module was called, then your module would deal with the value being set, and you would introduce a dependancy on the new module to this omniture module.