| 1 |
<?php |
<?php |
| 2 |
// $Id: omniture.module,v 1.6.4.1 2009/08/19 09:22:00 cytefx Exp $ |
// $Id: omniture.module,v 1.6.4.2 2009/08/19 09:23:16 cytefx Exp $ |
| 3 |
/* |
/* |
| 4 |
* @file |
* @file |
| 5 |
* Drupal Module: Omniture SiteCatalyst Stats |
* Drupal Module: Omniture SiteCatalyst Stats |
| 9 |
* |
* |
| 10 |
* @author: Greg Knaddison |
* @author: Greg Knaddison |
| 11 |
* @co-maintainer: Matthew Tucker |
* @co-maintainer: Matthew Tucker |
| 12 |
* |
* |
| 13 |
*/ |
*/ |
| 14 |
|
|
| 15 |
function omniture_help($path, $arg) { |
function omniture_help($path, $arg) { |
| 57 |
|
|
| 58 |
// Don't track page views in the admin sections, or for certain roles |
// Don't track page views in the admin sections, or for certain roles |
| 59 |
if (arg(0) != 'admin' && $track > 0) { |
if (arg(0) != 'admin' && $track > 0) { |
| 60 |
|
|
| 61 |
// Add any custom code snippets if specified |
// Add any custom code snippets if specified |
| 62 |
$codesnippet = variable_get('omniture_codesnippet', ''); |
$codesnippet = variable_get('omniture_codesnippet', ''); |
| 63 |
|
|
| 117 |
$footer .= '<!-- End SiteCatalyst code version: '; |
$footer .= '<!-- End SiteCatalyst code version: '; |
| 118 |
$footer .= check_plain(variable_get("omniture_version", 'H.13.')); |
$footer .= check_plain(variable_get("omniture_version", 'H.13.')); |
| 119 |
$footer .= ' -->'."\n"; |
$footer .= ' -->'."\n"; |
| 120 |
|
|
| 121 |
|
// Get variables other modules have set. |
| 122 |
|
$extra_variables = omniture_get_variables(); |
| 123 |
|
|
| 124 |
if ($omniture_hooked_vars = module_invoke_all('omniture_variables', $main)) { |
if ($omniture_hooked_vars = module_invoke_all('omniture_variables', $main)) { |
| 125 |
if (isset($omniture_hooked_vars['header'])) { |
if (isset($omniture_hooked_vars['header'])) { |
| 126 |
$header = $omniture_hooked_vars['header']; |
$header = $omniture_hooked_vars['header']; |
| 127 |
} |
} |
| 128 |
if (isset($omniture_hooked_vars['variables'])) { |
if (isset($omniture_hooked_vars['variables'])) { |
| 129 |
|
// We need to merge some variables here. |
| 130 |
foreach ($omniture_hooked_vars['variables'] as $k => $v) { |
foreach ($omniture_hooked_vars['variables'] as $k => $v) { |
| 131 |
|
if (is_array($v)) { |
| 132 |
|
$v = $v[count($v)-1]; |
| 133 |
|
} |
| 134 |
|
if (isset($extra_variables[$k])) { |
| 135 |
|
$v = $extra_variables[$k]; |
| 136 |
|
} |
| 137 |
$extra_variables_formatted .= "$k=\"$v\";\n"; |
$extra_variables_formatted .= "$k=\"$v\";\n"; |
| 138 |
} |
} |
| 139 |
} |
} |
| 227 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 228 |
'#description' => t('You can add custom SiteCatalyst code here.') |
'#description' => t('You can add custom SiteCatalyst code here.') |
| 229 |
); |
); |
| 230 |
|
|
| 231 |
$form['advanced']['omniture_codesnippet'] = array( |
$form['advanced']['omniture_codesnippet'] = array( |
| 232 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 233 |
'#title' => t('JavaScript Code'), |
'#title' => t('JavaScript Code'), |
| 234 |
'#default_value' => variable_get('omniture_codesnippet', ''), |
'#default_value' => variable_get('omniture_codesnippet', ''), |
| 235 |
'#rows' => 15, |
'#rows' => 15, |
| 236 |
'#description' => t('Paste <a href="@snippets">custom code snippets here</a>. These will be added to every page that SiteCatalyst appears on. For help with this feature see the <a href="@blog">cutroni.com blog</a>. <strong>Do not include the <script> tags</strong>, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/') ) |
'#description' => t('Paste <a href="@snippets">custom code snippets here</a>. These will be added to every page that SiteCatalyst appears on. For help with this feature see the <a href="@blog">cutroni.com blog</a>. <strong>Do not include the <script> tags</strong>, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/') ) |
| 237 |
); |
); |
| 238 |
|
|
| 239 |
return system_settings_form($form); |
return system_settings_form($form); |
| 240 |
} |
} |
| 241 |
|
|
| 242 |
|
/** |
| 243 |
|
* Builds up a set of properties and values ot add to the JS of the page. |
| 244 |
|
* |
| 245 |
|
* @param string $name |
| 246 |
|
* The property. |
| 247 |
|
* @param string $value |
| 248 |
|
* The value for the property. |
| 249 |
|
*/ |
| 250 |
|
function omniture_set_variable($name = NULL, $value = NULL) { |
| 251 |
|
static $variables; |
| 252 |
|
if (empty($name)) { |
| 253 |
|
return $variables; |
| 254 |
|
} |
| 255 |
|
else { |
| 256 |
|
$variables[$name] = $value; |
| 257 |
|
} |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
function omniture_get_variables() { |
| 261 |
|
return omniture_set_variable(); |
| 262 |
|
} |
| 263 |
|
|
| 264 |
/** |
/** |
| 265 |
* Example output from the omniture.com site itself. |
* Example output from the omniture.com site itself. |
| 271 |
<!-- SITECATALYST CODE --> |
<!-- SITECATALYST CODE --> |
| 272 |
<script language="javascript" src="/js/s_code_remote_h.js" type="text/javascript"></script> |
<script language="javascript" src="/js/s_code_remote_h.js" type="text/javascript"></script> |
| 273 |
<script language="javascript" type="text/javascript"> |
<script language="javascript" type="text/javascript"> |
| 274 |
<!-- |
<!-- |
| 275 |
// Copyright 1997-2004 Omniture, Inc. |
// Copyright 1997-2004 Omniture, Inc. |
| 276 |
|
|
| 277 |
// PAGE SPECIFIC VIA ISOL G & H |
// PAGE SPECIFIC VIA ISOL G & H |
| 278 |
|
|
| 279 |
var s_pageName='Omniture: Homepage'; |
var s_pageName='Omniture: Homepage'; |
| 280 |
var s_channel='Home'; |
var s_channel='Home'; |
| 283 |
s.channel='Home'; |
s.channel='Home'; |
| 284 |
s.prop6='English'; |
s.prop6='English'; |
| 285 |
|
|
| 286 |
// END PAGE SPECIFIC VIA ISOL |
// END PAGE SPECIFIC VIA ISOL |
| 287 |
|
|
| 288 |
// SiteCatalyst code version: G.7. |
// SiteCatalyst code version: G.7. |
| 289 |
var s_server="www.omniture.com" |
var s_server="www.omniture.com" |
| 305 |
var s_eVar13 = "" |
var s_eVar13 = "" |
| 306 |
var s_eVar14 = "" |
var s_eVar14 = "" |
| 307 |
var s_eVar15 = "" |
var s_eVar15 = "" |
| 308 |
// END G.7 CODE IMPLEMENTATION |
// END G.7 CODE IMPLEMENTATION |
| 309 |
|
|
| 310 |
// H.1 CODE BEGIN |
// H.1 CODE BEGIN |
| 311 |
s.server="www.omniture.com" |
s.server="www.omniture.com" |
| 312 |
s.campaign="" |
s.campaign="" |
| 313 |
s.events="" |
s.events="" |
| 314 |
s.products="" |
s.products="" |
| 315 |
s.prop1="Non-Customer" |
s.prop1="Non-Customer" |
| 316 |
s.prop3="Natural Search (All Other Engines)|"+s.pageName |
s.prop3="Natural Search (All Other Engines)|"+s.pageName |
| 317 |
s.prop5="Untracked" |
s.prop5="Untracked" |
| 318 |
s.prop14="" |
s.prop14="" |
| 319 |
s.prop15="" |
s.prop15="" |
| 320 |
s.prop16="" |
s.prop16="" |
| 343 |
s.eVar13="" |
s.eVar13="" |
| 344 |
s.eVar28="" |
s.eVar28="" |
| 345 |
s.eVar33="" |
s.eVar33="" |
| 346 |
// H.1 CODE END |
// H.1 CODE END |
| 347 |
|
|
| 348 |
var s_code=s.t();if(s_code)document.write(s_code) |
var s_code=s.t();if(s_code)document.write(s_code) |
| 349 |
//--> |
//--> |
| 350 |
</script> |
</script> |
| 353 |
<img src="http://omniturecom.112.2O7.net/b/ss/omniturecom/1/H.7--NS/0" height="1" width="1" border="0" alt="" /> |
<img src="http://omniturecom.112.2O7.net/b/ss/omniturecom/1/H.7--NS/0" height="1" width="1" border="0" alt="" /> |
| 354 |
</noscript> |
</noscript> |
| 355 |
|
|
| 356 |
|
|
| 357 |
<!-- BANNER TRACKING IF ANY --> |
<!-- BANNER TRACKING IF ANY --> |
| 358 |
<script language="javascript" src="/js/functions.js"></script> |
<script language="javascript" src="/js/functions.js"></script> |
| 359 |
<script language="javascript" src="/js/banner_track.js"></script> |
<script language="javascript" src="/js/banner_track.js"></script> |