-
Notifications
You must be signed in to change notification settings - Fork 3
/
webtrends.module
61 lines (51 loc) · 1.64 KB
/
webtrends.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Implementation of hook_menu().
*/
function webtrends_menu() {
$items = array();
$items['admin/settings/webtrends'] = array(
'title' => 'WebTrends',
'description' => 'Settings for the WebTrends analytics tool.',
'page callback' => 'drupal_get_form',
'page arguments' => array('webtrends_admin_settings_form'),
'access arguments' => array('administer site configuration'),
'file' => 'webtrends.admin.inc',
);
return $items;
}
/**
* Implementation of hook_footer().
*/
function webtrends_footer() {
$domain = variable_get('webtrends_domain', FALSE);
$dcs_id = variable_get('webtrends_dcs_id', FALSE);
if (!$domain || !$dcs_id) {
watchdog('webtrends', 'Webtrends module not configured.', array(), WATCHDOG_NOTICE);
return;
}
$script = <<<EOT
var _tag=new WebTrends();
_tag.fpcdom = ".$domain";
_tag.dcsid = "$dcs_id";
_tag.dcsGetId();
_tag.dcsCustom=function(){
if (typeof Drupal.settings.tingSearch != 'undefined') {
_tag.WT.oss = encodeURIComponent(Drupal.settings.tingSearch.keys);
// The result count is unknown when the page is loaded, so we just say 1.
_tag.WT.oss_r = 1;
}
}
_tag.dcsCollect();
EOT;
$html = <<<EOT
<noscript>
<div><img alt="DCSIMG" id="DCSIMG" width="1" height="1" src="http://visionize10.visionize.dk/$dcs_id/njs.gif?dcsuri=/nojavascript&WT.js=No&WT.tv=9.3.0&WT.dcssip=$domain"/></div>
</noscript>
EOT;
// We're relying on Drupal inserting inline js after references to
// external files.
drupal_add_js($script, 'inline', 'footer');
drupal_add_js(drupal_get_path('module', 'webtrends') . '/webtrends.js', 'module', 'footer');
return $html;
}