forked from aickowicz/mixpanel-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mixpaneljs.php
12 lines (11 loc) · 1.07 KB
/
mixpaneljs.php
1
2
3
4
5
6
7
8
9
10
11
12
<!-- start Mixpanel -->
<script type="text/javascript">(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("<?php echo $settings['token_id']; ?>");</script>
<script type="text/javascript">
mixpanel.set_config({
cross_subdomain_cookie: <?php if ($settings['subdomain_cookie'] === "true") { echo 'true'; } else { echo 'false'; } ?>,
debug: <?php if ($settings['debug_mode'] === "true") { echo 'true'; } else { echo 'false'; } ?>
});
</script>
<!-- end Mixpanel -->