Skip to content

Instantly share code, notes, and snippets.

@neelabhg
Last active August 29, 2015 14:06
Show Gist options
  • Save neelabhg/0b70a393176d218e103d to your computer and use it in GitHub Desktop.
Save neelabhg/0b70a393176d218e103d to your computer and use it in GitHub Desktop.
An object providing some dummy Mixpanel JavaScript library API functions for simple debugging
// Requires jQuery
window.mixpanel = {
register: function (properties, days) {
console.log('mixpanel register', properties, 'Registered for ' + days + ' days.');
},
track: function (event_name, properties, callback) {
console.log('mixpanel track', event_name, properties);
if (typeof callback === 'function') {
callback();
}
},
track_links: function (query, event_name, properties) {
$(query).click(function (e) {
var props = {};
if (typeof properties === 'object') {
props = properties;
} else if (typeof properties === 'function') {
props = properties(this);
}
console.log('mixpanel track links', event_name, props);
// Uncomment if you do not want links to be followed, so
// that the console does not refresh
//e.preventDefault();
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment