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?

1 Answer 1


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.

  • Wait, so on a single page site, how do they determine the avg time on site?
    – Dan
    Commented Jan 13, 2012 at 18:40
  • 1
    If it really is a single page, then I don't see how they can do that. Commented Jan 16, 2012 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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