I have the following code which is supposed to send a notification on ajax error to the user, and as a snap-solution, I decided to use google analytics to log those errors, however it doesn't work, does anyone have an idea/lead or must I implement a different solution?
showNotification(title, message) is a custom dialog box invoker.
$(document).ajaxError(function(e, xhr, settings) {
$(".modal").modal('hide');
showNotification('Something went wrong...', 'Whoa there! Something happened which we didn\'t predict, we sent ourselves a notification. ');
_gaq.push(['_trackEvent', 'AjaxError', xhr.status, settings.url]);
});
it works in the sense that it shows the notification, but it doesn't send an event to analytics. any leads?
showNotificationand_gaq.push. If that doesn't work, you could incorporate the_gaq.pushinto theshowNotificationfunction based ontitle.