Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
Exactly the answer I was looking for, thanks. – Dan Jan 13 '12 at 15:48
Wait, so on a single page site, how do they determine the avg time on site? – Dan Jan 13 '12 at 18:40
If it really is a single page, then I don't see how they can do that. – paulmorriss Jan 16 '12 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.