Google Analytics and partials

I have been tracking users with Google Analytics via the javascript code
in the header of my main template and that works very well.

I've come to realize that there are a few places where I have
will_paginate and some cascading collections where there are partials
that update but the entire page does not refresh and thus, even though
the content is changed, the click activity is never recorded by Google
and I am essentially cheating myself from the intelligence of what users
actually are doing.

Obviously I can re-locate the google javascript code for sending the
reports to Google Analytics from the main template to the inner-most
partial for each of my pages but that seems to be very redundant and not
very dry so I'm wondering how do other people handle this? Is there a
way to just execute when the partial is redrawn? Is it possible to use
observers to refresh 2 divs on the same page? (albeit one in the main
template and one in a partial)?

Craig

I have been tracking users with Google Analytics via the javascript code
in the header of my main template and that works very well.

I've come to realize that there are a few places where I have
will_paginate and some cascading collections where there are partials
that update but the entire page does not refresh and thus, even though
the content is changed, the click activity is never recorded by Google
and I am essentially cheating myself from the intelligence of what users
actually are doing.

Obviously I can re-locate the google javascript code for sending the
reports to Google Analytics from the main template to the inner-most
partial for each of my pages but that seems to be very redundant and not
very dry so I'm wondering how do other people handle this? Is there a
way to just execute when the partial is redrawn? Is it possible to use
observers to refresh 2 divs on the same page? (albeit one in the main
template and one in a partial)?

Leave it where it is and use their API to "make a call".

http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55521

> I have been tracking users with Google Analytics via the javascript
> code
> in the header of my main template and that works very well.
>
> I've come to realize that there are a few places where I have
> will_paginate and some cascading collections where there are partials
> that update but the entire page does not refresh and thus, even though
> the content is changed, the click activity is never recorded by Google
> and I am essentially cheating myself from the intelligence of what
> users
> actually are doing.
>
> Obviously I can re-locate the google javascript code for sending the
> reports to Google Analytics from the main template to the inner-most
> partial for each of my pages but that seems to be very redundant and
> not
> very dry so I'm wondering how do other people handle this? Is there a
> way to just execute when the partial is redrawn? Is it possible to use
> observers to refresh 2 divs on the same page? (albeit one in the main
> template and one in a partial)?

Leave it where it is and use their API to "make a call".

http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55521