by Bob Dombroski
I had a client that just wanted a simple report he could easily
see in real time, that would show him only what he wanted to see. He
had 5 requirements.
- How many hits total for any page and all pages.
- How many hits for any and all pages today.
- How many hits for any and all pages this month.
- How many users are currently browsing the site.
- The number of highest simultaneuos connections throughout the
day.
I had a client that just wanted a simple report he could easily
see in real time, that would show him only what he wanted to see. He
had 5 requirements…
I am sure there are many prepackaged solutions which may have
worked, but the task is simple enough to code in ASP. I decided to
use a database solution to track the hits.
The database table (Access Database) called hits
- page_name – text field max of 100 (contains the
page name) - total_hits – long
(contains the total hits on page since its inception) - day_hits – long
(contains the total hits on page today) - month_hits – long (contains the total hits
on page this month) - hit_date – Date/Time (the
date of the current day & month hits)
Pretty simple so far…and it doesn’t get any harder!
I created an include file counter.inc which is included in every
page I want counted. For my client, he did not want the
adminstration pages to inflate his hit counts so the include file
would not be within any of the admin pages.