views:

34

answers:

1

Hello!

So I've got an Ajax-based webapp. The homepage serves most - almost all - of the site's functionality. It's split into 3 columns, and the first two are loaded from the page's HTML. The third column is loaded dynamically based on what is selected in the second column.

Would tracking an Ajax-based app with Analytics be as easy as putting the tracking code at the bottom of the PHP file that returns the contents of the third column? This seems logical to me, but, I'm a bit of an Analytics newbie and am sure you guys have much better answers.

Jack

+3  A: 

As far as I know, this is usually done by calling ga.js's tracking events in your Ajax code. Including the snippet <script> probably wouldn't work.

There used to be a number of reference pages on the Google Analytics docs ("How to track Ajax applications"), but they are all gone for some reason.

The info in this support thread looks good. This is the asynchronous way to track a page view:

_gaq.push(['_trackPageview', '/pagefilename1']);

there are more push() examples in the reference.

Pekka