diff options
author | raylu <raylu@mixpanel.com> | 2011-11-05 14:47:27 -0700 |
---|---|---|
committer | raylu <raylu@mixpanel.com> | 2011-11-05 14:47:46 -0700 |
commit | 4f36134942db927bf7e2e3e754240231435abf9b (patch) | |
tree | 754f030ae42eec9fd0ff06dbe005ad4c6fe6b860 /includes/header.php | |
parent | b4a6e9e61aa4737d92499b3a60bd55335c92b57b (diff) | |
download | pathery-4f36134942db927bf7e2e3e754240231435abf9b.tar.xz |
add mixpanel streams tracking
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/includes/header.php b/includes/header.php index 9340c3f..a9d3538 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,7 +1,7 @@ -<?PHP
+<?php
function htmlHeader($css) {
-?>
+ ?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<head>
@@ -18,11 +18,11 @@ function htmlHeader($css) { <script src="js/ajax.js" async="async"></script>
<script src="js/mapspecs.js" async="async"></script>
</head>
-<?
+ <?php
}
function htmlFooter() {
-?>
+ ?>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-371072-3']);
@@ -34,20 +34,41 @@ function htmlFooter() { }
};
- (function() {
- var proto = document.location.protocol;
- var ga = document.createElement('script');
- ga.type = 'text/javascript';
- ga.async = true;
- ga.src = ('https:' == proto ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0];
- s.parentNode.appendChild(ga, s);
+ var mpq=[];
+ mpq.push(['init','24743c6567f831ddfcbbbd3f397e11e4']);
+ (function() {
+ var proto = document.location.protocol,
+ s = document.getElementsByTagName('script')[0].parentNode;
var wf = document.createElement('script');
wf.src = ('https:' == proto ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
- s.parentNode.appendChild(wf, s);
+ s.appendChild(wf, s);
+
+ var b,e,d,c;
+ b=document.createElement('script');
+ b.type='text/javascript';
+ b.async=true;
+ b.src=(proto==='https:'?'https':'http')+'://api.mixpanel.com/site_media/js/api/mixpanel.js';
+ s.appendChild(b);
+ e=function(f){return function(){mpq.push([f].concat(Array.prototype.slice.call(arguments,0)))}};
+ d=['init','track','track_links','track_forms','register','register_once','identify','name_tag','set_config'];
+ for(c=0;c<d.length;c++){mpq[d[c]]=e(d[c])};
+ <?php
+ if ($_SESSION['accepted'] == 1) {
+ if ($_SESSION['displayName'] != 'noname')
+ echo 'mpq.name_tag(' . json_encode($_SESSION['displayName']) . ');';
+ if ($_SERVER['HTTP_HOST'] == 'www.pathery.com')
+ echo 'mpq.identify(' . json_encode($_SESSION['userID']) . ');';
+ }
+ ?>
+
+ var ga = document.createElement('script');
+ ga.type = 'text/javascript';
+ ga.async = true;
+ ga.src = ('https:' == proto ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ s.parentNode.appendChild(ga, s);
})();
</script>
|