by Paulo Borges (1 Submission)
Category: Graphics
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Sun 27th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Site statistics chart generator
API Declarations
This is a graphic display of traffic registered on a given web site.
It is consisted of three modules. The first logs every user that enters the site and record this information in an access database. When a user requests the site statistics page an .asp routine executes and summarizes information from the access.mdb log file and formats it to be displayed by a chart java applet.
I have used two applications found in the Internet to accomplish this:
The first is the .asp routine that captures user visits and records it to the access database, this is called the sitelog.asp
The second is Tchart (developed by R. BERTHOU.) that can be downloaded from http://www.javaside.com (Pleased download tChart V 5.20) freeware
All it is needed to make it work is to install sitelog and have it working. Make sure that the access database is in a subdirectory ‘data’ of your web site. For that follow the instructions on the downloads of sitelog.
About Tchart, all you will need is to copy the following files to the root of your site:
tchart2.jar, tchart2.class
To link those two modules I have developed sitestat.asp, what it will do is take information from the access database populated by sitelog.asp and feed to Tchart so it will produce the graphics that represent site visit statistics by month
It can be seem in action at http://www.dataserv-mz.com/sitestat.asp
Paulo Borges
<html>
<head>
<META Name="ROBOTS" Content="NOINDEX, NoFollow">
<title>Site Statistics</title>
</head>
<body bgcolor="white">
<%
Dim RS,Conn,StrSQL
Set RS = Server.CreateObject("ADODB.RecordSet")
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data/siteLog.mdb")
strSQL = "SELECT * FROM tblSession WHERE tYearNumber = year(date)"
RS.Open strSQL, Conn, 3, 3
%>
<applet archive="tchart2.jar" code="tchart2.class" width=500 height=200>
<param name="Copyright" value="RBL : [email protected]">
<param name="file" value="z">
<param name=font value="Arial">
<param name=fontsize value=10>
<param name=bgcolor value=14737632>
<param name=_frame value=40>
<param name=bgImg value="./images/grphBack.gif">
<param name="z0" value="With Bullets ; 1 ; za ; 1 ; 2">
<param name="z1" value="Use Mouse ; 1 ; za ; 1 ; 11">
<param name="z2" value="Bar With Text ; 1 ; za ; 0 ; 11">
<param name="za0" value="title ; DataServ's Trafic Analizer ">
<param name="za1" value='label ; http://www.dataserv-mz.com ; Número de "hits"'>
<param name="za2" value="col ; ____ ; 122500 ">
<%
Dim i, TotVisits(12)
RS.MoveFirst
Do while not RS.eof
i = MONTH( RS("date"))
TotVisits( i ) = TotVisits( i ) + 1
RS.movenext
Loop
For i = 0 TO 12
If i = 1 then
Response.write("<param name='za3' value='Jan_;" & TotVisits(i) & "'>")
ElseIf i = 2 then
Response.write("<param name='za4' value='Fev_;" & TotVisits(i) & "'>")
ElseIf i = 3 then
Response.write("<param name='za5' value='Mar_;" & TotVisits(i) & "'>")
ElseIf i = 4 then
Response.write("<param name='za6' value='Abr_;" & TotVisits(i) & "'>")
ElseIf i = 5 then
Response.write("<param name='za7' value='Mai_;" & TotVisits(i) & "'>")
ElseIf i = 6 then
Response.write("<param name='za8' value='Jun_;" & TotVisits(i) & "'>")
ElseIf i = 7 then
Response.write("<param name='za9' value='Jul_;" & TotVisits(i) & "'>")
ElseIf i = 8 then
Response.write("<param name='za10' value='Ago_;" & TotVisits(i) & "'>")
ElseIf i = 9 then
Response.write("<param name='za11' value='Set_;" & TotVisits(i) & "'>")
ElseIf i = 10 then
Response.write("<param name='za12' value='Out_;" & TotVisits(i) & "'>")
ElseIf i = 11 then
Response.write("<param name='za13' value='Nov_;" & TotVisits(i) & "'>")
ElseIf i = 12 then
Response.write("<param name='za14' value='Dez_;" & TotVisits(i) & "'>")
end if
Next
%>
</applet>
</body>
</html>