Google Analytics에서 jQuery AJAX 호출들을 추적가능하도록 만들기

Read Time:38 Second

원본 글:

The code

This code will automatically log all jQuery AJAX requests in our application, including those using $.ajax()$.get(), or $.post().

This will also work for any jQuery plugins using AJAX requests (e.g. lightbox plugins, etc.), as well as for all Rails 3 remote links and forms(provided we’re using the jQuery UJS driver).

In the page layout or in an included js file, we add the following JavaScript:

jQuery(function ($) {

// Log all jQuery AJAX requests to Google Analytics
$(document).ajaxSend(function(event, xhr, settings){

_gaq.push([‘_trackPageview’, settings.url]);


If we’re using this in a Rails 3 app, we can put this in our master.js file.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.