Jim Rey wrote: > Hi > > I have just discovered that the Mason Users Archive is down for > maintenance. > > Does anyone have any useful code to measure site "hits"? > I'm really after individual hits rather that everytime the same person > clicks another page on the same site. > I'm using Apache 2, Mason 2 using mod_perl 2 with mysql. > > Cheers > > Jim Rey
People usually (in my experience, at least) do this by analysing the access logs afterwards. Something like Webalizer or Awstats does this. If you want to do this in mason, I'd suggest some code in your root autohandler that checks $r->connection->remote_ip, and increments a counter if it has not appeared yet today. The difficulty being that you'll probably want to count people again if they visit your site multiple times on different days. You'll need to reset your cache of IP addresses once a day, or timestamp the first appearance, and check whether it occured yesterday.
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users