Last active
August 29, 2015 14:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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