diff options
author | raylu <raylu@mixpanel.com> | 2012-04-25 22:38:05 -0700 |
---|---|---|
committer | raylu <raylu@mixpanel.com> | 2012-04-25 22:38:05 -0700 |
commit | c8783d4dc257913ba527d469c88d7b97770be3de (patch) | |
tree | d358a1ba97523e6dd8988a54dc49ac9ff0b739bb /includes/header.php | |
parent | 5b23aea4a86478617dcd398a9ce57ea6cfbaac21 (diff) | |
download | pathery-c8783d4dc257913ba527d469c88d7b97770be3de.tar.xz |
upgrade mixpanel lib to v2
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/includes/header.php b/includes/header.php index 8beac75..3f83530 100644 --- a/includes/header.php +++ b/includes/header.php @@ -36,8 +36,6 @@ function htmlFooter() { }
};
- var mpq=[];
- mpq.push(['init','24743c6567f831ddfcbbbd3f397e11e4']);
(function() {
var proto = document.location.protocol,
s = document.getElementsByTagName('script')[0].parentNode;
@@ -48,23 +46,6 @@ function htmlFooter() { wf.async = 'true';
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';
@@ -72,6 +53,18 @@ function htmlFooter() { ga.src = ('https:' == proto ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
s.parentNode.appendChild(ga, s);
})();
+
+ (function(d,c){var a,b,g,e;a=d.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===d.location.protocol?"https:":"http:")+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';b=d.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var b=c;"undefined"!==typeof f?b=c[f]=[]:f="mixpanel";g="disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config".split(" ");
+ for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
+ mixpanel.init("24743c6567f831ddfcbbbd3f397e11e4");
+ <?php
+ if ($_SESSION['accepted'] == 1) {
+ if ($_SESSION['displayName'] != 'noname')
+ echo 'mixpanel.name_tag(' . json_encode($_SESSION['displayName']) . ');';
+ if ($_SERVER['HTTP_HOST'] == 'www.pathery.com')
+ echo 'mixpanel.identify(' . json_encode($_SESSION['userID']) . ');';
+ }
+ ?>
</script>
</body>
|