Skip to content

Instantly share code, notes, and snippets.

@booty
Last active December 15, 2015 05:19
Show Gist options
  • Save booty/5208224 to your computer and use it in GitHub Desktop.
Save booty/5208224 to your computer and use it in GitHub Desktop.
The success/failure callbacks in Keen.addEvent don't seem to work in Internet Explorer 9. This code works in the latest versions of FF, Chrome, Safari, and Opera. In IE9, the call to Keen.addEvent succeeds (and I can view it on my project page at http://Keen.io! but the functions inside the callbacks (the window.location.href calls) are never ex…
/*
Set a jQuery event handler; we want to record outgoing clicks with Keen.io
*/
$('a').click(function (e) {
e.preventDefault(); // otherwise, we'll navigate to new page before Keen object fires tracking event back to server
var linkName = e.currentTarget.title || e.currentTarget.href; // fall back to href if no title
Keen.addEvent("Link Clicked", {
LinkName: linkName,
CalendarCode: $.cookie('refCode')
},
function () {
// gets called in all major desktop browsers, but not IE9?
window.location.href = e.currentTarget.href;
},
function () {
// gets called in all major desktop browsers, but not IE9?
window.location.href = e.currentTarget.href;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment