I am trying to track my pages via google analytics, here is my code
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXXXXXXXX']);
_gaq.push(['_setDomainName', 'somesite.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function ($) {
// Log all jQuery AJAX requests to Google Analytics
$(document).bind('ajaxComplete', function(event, xhr, settings){
console.log('ajax Request');
console.log(settings.url);
_gaq.push(['_trackPageview', settings.url]);
});
})(jQuery);
On each ajax request I can see the console has values
ajax Request
url of the page
it means _gap.push is working (as there is no js error on page). But when I am checking my req/res via Live HttpHeaders there is no req/res to google analytics, How to track it?
here is the screenshot in firebug

The point in _gaq.push is that, until Google Analytics is actually loaded, “_gaq” is just a normal array. That is: the lack of errors is indeed expected, regardless of whether or not it is “working” in the sense of triggering a request to Google.
The way Google Analytics works is not via ajax (or at least, there is no specific implementation detail regarding how the request will be sent). The method usually used is to create an Image element with the tracking data included in the query string of that image’s URL. After all, the page doesn’t care what response Google Analytics has, it just wants to send its data and go!