Skip to content

Instantly share code, notes, and snippets.

@ttrefren
Created November 6, 2009 16:48
Show Gist options
  • Select an option

  • Save ttrefren/228091 to your computer and use it in GitHub Desktop.

Select an option

Save ttrefren/228091 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
var mp_protocol = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + mp_protocol + "api.mixpanel.com/site_media/js/api/mixpanel.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var mpmetrics = new MixpanelLib("YOUR TOKEN");
} catch(err) {
null_fn = function () {};
var mpmetrics = { track: null_fn, track_funnel: null_fn, register: null_fn, register_once: null_fn };
}
// jquery onload event
$(function(){
console.log("view");
mpmetrics.track('View');
});
</script>
</head>
<body>hi</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment