Recently I had one requirement from client to capture even ajax requests in application for google analytics reports.
I changed google analytics account for capturing dynamic content and added following javascript code in application.js file and it worked.
$(function() {
// Log all jQuery AJAX requests to Google Analytics
$(document).ajaxSend(function(event, xhr, settings){
if (typeof _gaq !== "undefined" && _gaq !== null) {
_gaq.push(['_trackPageview', settings.url]);
}
});
});
Wednesday, April 11, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment