views:

992

answers:

3

how services like google analytics calculate parameters like

"average time spent"
"number of users that came to the website via search Vs user that hit the url directly
etc.

I would imagine that google can easily record a HIT when someone clicks on a link in serach result. But after that how long and deep the user is brwosing that perticular website is out of tap...hmmmm ?

+2  A: 

This question has some information. As mentioned in that question time should be calculated using an onUnload() event. When the js is loaded firstime the time may be recorded (in cookies)and then onUnload() the time spent is calculated and sent to Google for record.

The above question explains most of your question.

Shoban
A: 

With Google Analytics, you are probably tracked on your website and also outside whenever you browse a website outside yours that uses GA (which happens quite frequently). By combining a local cookie along with a Google Cookie, I think this renders possible to follow a visitor "in" and "out" a given website, thus allowing you to compute very precisely how long you stayed on the last page.

Other techniques include using a session cookie that expires after a given delay (say 1 minute) so that if you ever stand still more than one minute on a webpage without doing anything, the cookie expires and GA will know that at next refresh (because he won't find the short lasting cookie but might find a longer running cookie still alive).

It is also possible by using some statistics distribution to attribute a mean "time spent" for a user who has visited a given page as the last one on a website just by computing how long the others users passing by this page have stayed on the site. This probably give slight wrong result for small traffic website but I think this is valid as soon as the number of visitor raises.

Modern website statistics aggregators (AW-Stats, Webalizer) provide that kind of data with no JavaScript hooks.

Oct
+2  A: 

This thread states quite clearly that there is no unLoad() event: http://groups.google.com/group/analytics-help-troubleshoot/browse%5Fthread/thread/d142572ddf1fa9dd/38dd640f949e9890?pli=1

Also, try going to GA and look for sessions with only 1 pageview - you will see the average page time is 0s, which proves the point.

tpk