Timing length of time on a page

Discussion in 'JavaScript' started by Mayhem Design, Jun 17, 2010.

  1. #1
    Hi all,

    I'm wondering how you could go about timing how long a visitor is on a page using an external JavaScript file. This is similar to what Google Analytics must do as it only calls the one JS file from the Google server. Can you call an onunload from an external JS file or is there a better way?

    Does anyone know how much of what GA tracks is purely cookie based with the occasional call-back to their server or is most of it done through regular call-backs to track all their stuff?

    Any help / tips / tricks would be appreciated as I need to build a really cut down version of what GA does for a client who doesn't want to use a 3rd party stats site to log all this data.

    Thanks
     
    Mayhem Design, Jun 17, 2010 IP