dcsimg

Page Hit Counter System

By ServerWatch Staff (Send Email)
Posted Jan 11, 1999


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

  1. page_name - text field max of 100   (contains the page name)
  2. total_hits     - long   (contains the total hits on page since its inception)
  3. day_hits      - long   (contains the total hits on page today)
  4.   month_hits - long   (contains the total hits on page this month)
  5.   hit_date     - Date/Time  (the date of the current day & month hits)

table.jpg

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.

Page 1 of 4


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.


 

 


Thanks for your registration, follow us on our social networks to keep up-to-date