Hi,
Happy to help clarify.
Google Analytics collects time stamps for each hit (server request)
generated by the ga.js. Each hit has a certain type and only:
pageviews, events, transactions and items are included in the
ga:timeOnSite calculation.
ga:TimeOnSite is visit based where a visit increments:
- when the browser closes
- if > 30 mins has elapsed between time stamps
- the end of the day
In ga.js, __utmb is a cookie set to expire for 30 minutes in the
future. __utmc is a session cookie which expires when the browser
closes. Each tracking request checks both cookies and if either isn't
present the visit is incremented. Ending the session at the end of the
day happens when your data is processed and is defined by midnight of
the time configured for an individual profile.
To arrive at ga:timeOnSite, GA sums the deltas between each timestamp
(for the hit types above) in a visit. The main edge cases is the last
hit in a session, where we can't compute the delta. In that case the
quantum of time between the last hit and the session end is not added
to the calculation.
Hope that clarifies the question :)
-Nick