Skip to content

Instantly share code, notes, and snippets.

@carlsverre
Created July 7, 2011 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carlsverre/1068802 to your computer and use it in GitHub Desktop.
Save carlsverre/1068802 to your computer and use it in GitHub Desktop.
Multiple mixpanel instances on the same page using the Async library
<html>
<head>
<title>Your page</title>
</head>
<body>
<div>Your content</div>
<script type="text/javascript">
var mpq=[];mpq.push(["init","0725059687a1080dffb343076224e1b1"]);(function(){var a=document.createElement("script");a.type="text/javascript";a.async=true;a.src=(document.location.protocol==="https:"?"https:":"http:")+"//api.mixpanel.com/site_media/js/api/mixpanel.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)})();
mpq.push(function() {
window.mpq2 = new MixpanelLib("7efd61a5d7fb7b37549f15e9cb0fcb22", "mpq2");
// at this point (and after this function has been called), window.mpq2 is an instance of the full mixpanel library
// so you would do window.mpq2.track("Event") rather than window.mpq2.push(["track", "event"])
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment