..


Sponsored Links

A hit for the site in ASP and Access

Article written by Luca Ruggiero
Page 1 of 3

Introduction

In several previous articles in the ASP section we saw how different types of counters based on database access, file-tense or XML documents.

What we achieve in this article is a system, a bit 'more complex, to monitor the traffic on a website, a simple script based on ASP and a Microsoft Access database.

Specifically, we will create a counter that identifies the traffic (divided into unique hits and page views) per day, month and year, and also a summary page that displays the traffic data for the current month (divided by day) and previous months.

For those who do not know the difference between unique hits and page views is that a single access is represented by a person who accesses a site and page views are the same pages that the user visits during the browsing session .

For example, if I go to the homepage centre-equestre-lepuy.com I created a single access and a page view. If I'm nice section ASP and I click on an article I created two more page views, but it's still only one single entry.

Overview Statistics

Just install the script that we called ASP Stats MRW (free download here ), the appearance of the display panel of the statistics is as follows:

We see that in the month of April 2010 there is no data traffic, even the monthly total of unique hits and page views will be zero.

Conversely, if there is data traffic, the appearance of the panel would be the following:

We note then the data divided by day and the total of the current month, as well as the ability to browse through the selection of the panel month and year.

Database structure and application

We create the database file stats.mdb within which there will be counter to the table, accompanied by the following fields:

  • id - (Counter)
  • days - (Numeric)
  • mm - (Numeric)
  • aa - (Numeric)
  • au - (Numeric)
  • pv - (Numeric)
As the names of the fields left to understand, "dd", "mm" and "aa" represent days, months and years, and "au" and "pv" represent unique visits and page views.

The ASP files we create, however, are as follows:

  • config.asp - configuration file that contains functions for opening and closing the database connection, as well as the declaration of all variables of the application.
  • add.asp - files that will include all pages of the site, whose purpose is to increase the counter.
  • stats.asp - page view statistics, documented in the previous screenshots.
We'll also create a simple CSS style sheet to make more pleasant the consultation panel.

The CSS

Before moving to the ASP code, we create the style sheet for the application. Here's the code:






 Body







 {



    



 background: # EEEEEE;



    



 color: # 000000;



    



 margin: 10px 0px 0px 10px;







 }







 th, td, p, input, select







 {



    



 font-size: 13px;



    



 font-family: verdana;







 }







 th, tr.totale







 {



    



 background: # 000000;



    



 color: # FFFFFF;







 }







 p form







 {



    



 margin: 0px 0px 0px 10px;







 }







 tr.bianco, td.errore







 {



    



 background: # FFFFFF;







 }







 td.errore







 {



    



 text-align: center;







 }







 tr.grigio







 {



    



 background: # CCCCCC;







 }



Save the code in the file stats.css.

In the same category ...
E-Learning
ASP (Advanced) ASP (Advanced)
Full course for creating dynamic Web sites. From 39 €.
ASP Zero (Ebook) ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €.
ASP and Access (Ebook) ASP and Access (Ebook)
Managing a MS Access database with ASP. At only 29 €.
Sponsored Links