Does anyone know how Google Analytics tracks how long a user has been on the site? When the user leaves the page that has analytic tracking code, won't the sending/receiving link be broken? How are they able to retrieve the last bits of information before the user leaves the page?
Here's an answer to that question from the Google forums
The way that Google Analytics calculates average time on site is by subtracting the timestamps between the first and the last pageview of a visit. ... There is no way for Google Analytics to know exactly when a visitor left the site since no information is sent back to GA when the visitor closes their browser or navigates to a different site.
So I read that to mean that they measure the time from the first page view to the last page view, because they can't tell how long that page was viewed for.