views:

558

answers:

2

I'm trying to use Google Analytics to track any Ajax request made by my web application (in my case built on ExtJS, but it doesn't matter right now).

I wrote few lines of code to track all Ajax requests:

Ext.Ajax.on('requestcomplete', function(connection, options) {
    pageTracker._trackPageview('/'+options.url);
});

but it doesn't work (it kind of works, but it doesn't track all the request). The numbers I'm getting are much lower than the number of my requests.

+2  A: 

it could be that you're using the old tracking code, if so your code should look like:

Ext.Ajax.on('requestcomplete', function(connection, options) {
    urchinTracker('/'+options.url); 
});
seengee
Thanks for pointing this out, but unfortunately this isn't my case.
Igor Pavelek
A: 

After rechecking whether the code was properly installed it turned out that it was not. Sorry for my mistake, hopefully this snippet will be useful for somebody who is looking for a way of tracking Ajax requests using ExtJS.

Igor Pavelek