-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathanalytics.inc
40 lines (34 loc) · 1.46 KB
/
analytics.inc
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
<?php
$has_analytics = true;
$analytics_account = "UA-305132-6";
function analytics_print($virtual_page=null, $account=null) {
/*
* first, the feedburner stuff
* login went to fink-core-private, 02/23/2007
*/
print "<script src=\"http://feeds2.feedburner.com/~s/FinkProjectNews\" type=\"text/javascript\" charset=\"utf-8\"></script>\n";
if ($account == null) {
global $analytics_account;
$account = $analytics_account;
}
// next, google analytics
print "<script type=\"text/javascript\">\n";
print "(function ga_init() {\n";
print " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n";
print " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n";
print " (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);\n";
print "})();\n\n";
print "var _gaq = _gaq || [];\n";
print " _gaq.push(['_setAccount', '$account']);\n";
print " _gaq.push(['_gat._anonymizeIp']);\n";
if ($virtual_page != null) {
print " _gaq.push(['_trackPageview', '$virtual_page']);\n";
} else {
print " _gaq.push(['_trackPageview']);\n";
}
print "</script>\n";
}
function analytics_download_link($href, $contents, $analytics_name) {
print "<a href=\"$href\" onClick=\"_gaq.push(['_trackPageview', '" . str_replace(array("'", "\""), array("\\'", "\""), $analytics_name) . "']);\">" . $contents . '</a>';
}
?>