ServersPage Hit Counter System

Page Hit Counter System

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




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.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories