Toby logo

Blog

This is where you can see what I have been doing recently...


Server logging

07 May 2006

Looking at my server logs, I have noticed that quite a significant number of  people visit just one page of this website, then disappear. Unfortunately, this means that I am unable to find out whether they actually read that page or just immediately hit back because there's no data on how long they spent looking at the page; I only see the initial page load.

However, now, I have introduced an AJAX-style way to find out how long people spend looking at my pages. What it does, is it sends out a request after 5 seconds, then 10, then 20, then 40 etc to the server where it's logged and I can read it. To avoid flooding the logs, I have made it so that the time interval between each request doubles each time and, just in case someone opens the page then leaves it for a couple of hours, I have made script stop after about 5 minutes.

If you want to see the code, hit View > Source; it's near the top of the file. I'm not really very familiar with JavaScript so please tell me if you spot any bugs I made.

Permanent link

Tools


Powered by Google

Written by Toby. This work is licensed under a Creative Commons License. Privacy