Skip to content

Instantly share code, notes, and snippets.

@rauchg
Created February 23, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rauchg/840963 to your computer and use it in GitHub Desktop.
Save rauchg/840963 to your computer and use it in GitHub Desktop.
(function () {
mpq = [['init', MIXPANEL_TOKEN]];
var mpmetrics = {}
, methods = ['track', 'track_funnel', 'register', 'register_once'
, 'register_funnel', 'identify'];
for (var i = 0, l = methods.length; i < l; i++)
(function(method) {
mpmetrics[method] = function () {
mpq.push([method].concat(Array.prototype.slice.call(arguments)));
};
})(methods[i]);
// load the real thing
var mp = document.createElement("script"); mp.type = "text/javascript";
mp.async = true; mp.src = (document.location.protocol == 'https:' ? 'https:'
: 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(mp, s);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment