|
There are literally
thousands of website statistics systems available on the Internet. Some
provide complex analysis, whilst others provide very basic information.
Sometimes simply due to whom your web provider is you may not be able to
install your own statistics applications. I will set out in this
article to provide a very basic web statistics database that will allow
you to catch whom is visiting your web site and where they are coming
from.
The first step in the
process of building your own web statistics database is to identify
where you will store the statistical information you have collected. In
this example, I have decided to store all the data in a Microsoft Access
database. I basically created the database in Microsoft Access and
called the database "dbStatistics".
The next step is to
build a table in which you will store the data. The table in the
database will be called "tblStatistics". The table needs five fields
and the names are:
fldPageName
DataType - Text 255 Characters
fldIPNumber
DataType - Text 255 Characters
fldAll_Http
DataType - Memo
fldAll_Raw
DataType - Memo
fldTimestamp
DataType - DateTime Default Value - Date() & " " & time()
The information above
simply defines the type of fields each field should be set to and some
specific field properties which will be important for this code to
work. You will note that there are no primary key fields. The reason
this is undertaken is that the AutoNumber function in Microsoft Access
is to limiting in the volume of data that you can hold.
You will also notice
that there is a field called fldTimestamp. This field allows you to
store the exact local Date and Time the person visited your website.
The local time is the time on your server that is hosting your webpages.
For this basic web
statistic log to work, we now need to get the information into the
database. The first thing you need is to ensure that your provider can
in fact support ASP (Active Server Pages) pages. Most web hosting
companies can support them, but it is worth checking.
We now need to add
the code to each webpage that will log information on who is visiting
your website and also which websites were referrers and the browsers
they were using and what language they were searching in. You will find
out all this information in both the fldAll_Http and fldAll_Raw fields.
The following code
needs to be copied into the top part of your webpage before the HTML
tag.
<%@
Language=VBScript %>
<%
on
error resume next
'<-----------------WEBLOGGING START------------------------>
dim
strpagename,strwho, stradvert
dim
cn, strconnect
dim
strip
dim
strAll_http,strremote_addr,strall_raw
' The
Field Below Tells you the page they visited
strPageName = request.servervariables("server_name") &
request.servervariables("URL")
'The
Field Below Tells you the visitors IP Numbers
strip
= request.servervariables("Remote_Addr")
'The
fields below contain all the information such as the website
'
that referred them to your page etc.
strAll_http = request.servervariables("ALL_HTTP")
strall_raw = request.servervariables("all_raw")
set
cn=server.createobject("adodb.connection")
'This
code connects to your database
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/_private/dbstatistics.mdb")
cn.open(strConnect)
'This
code inserts the collected information into your database
cn.execute "insert into
tblstatistics(fldpagename,fldipnumber,fldAll_http,fldAll_raw)values('" &
strPageName & "','" & strip & "','" & strall_http & "','" & strall_raw &
"')"
cn.close
'<------------------WEBLOGGING END ------------------->
%>
The Microsoft Access
Database must be stored into the _Private folder on your website. If you
do not put the database in that position, anyone who visits your website
could in fact download your statistics. Apart from that this code will
not work. The danger of allowing someone access to your web statistics
database is that your competitors could find out who is visiting your
website and from where and as such this is really a serious business
intelligence issue.
The code shown above
has a number of pieces of information that is really useful in working
out what is going on with your website. In the field fldPagename the
actual page that a person is visiting is stored. In the field
fldipnumber the IP number of the visitor is stored. Between these two
pieces of information you can find out how a person has entered the
site, what they have visited and also with the field fldTimestamp you
can work out how long they looked at each page before they moved onto
the next one.
The field fldipnumber
contains powerful information. On the internet there are a number of
lists of who owns what IP Numbers and also which countries they have
been assigned to. By collecting the IP Numbers and in conjunction with
the IP Database we can work out from what countries people are visiting
our website. We can get detailed information to the point of which
cities and even the ISP's who are providing the IP Numbers. With this
information it allows us to setup our web pages to be in line with the
characteristics and attributes that are standard for that country.
Using a Microsoft
Access Database as your datastore means that you can manipulate the data
and filter it to find out how people are visiting your website and who
is referring them. This information is stored in the fldAll_Http and
fldAll_Raw fields. These fields will also contain important information
such as what browsers and operating systems people are using to visit
your website. For example not all browsers interpret HTML in exactly the
same way. So if you found that 90% of your customers were in fact using
the browser SAFARI which is the Apple Browser then you would be
developing your website for this customer base and browser. If 90% of
your customers were using Firefox then you would develop your web pages
taking into account the idiosyncrasies of that browser.
There is a lot of
powerful information contained in these logs and I strongly encourage
you to get some Microsoft Access Database Development Experience that
will help you analyze the logs even further than what has been discussed
in this article.
Remember one thing,
when it comes to SEO or Search Engine Optimization it is the web logs
that will tell you everything about your visitors and whether or not
your SEO Strategies are in fact working.
=========================================================
HOW TO DOWNLOAD THE SAMPLE
FILES
You can download the sample files for
this website by clicking on the Buy Now Button. The cost of the sample
files is just $9.99USD.
|
If at anytime you
need any assistance please contact us through Live Support or
call us on 1800 66 00 00 or International
+61 7 47237811 |
Sitemap |
Article
List | Information
Partners
©
2006 One-on-One
Personal Computer Training
(is
owned by Chris Le Roy Consulting Pty Ltd)
Visit Our
Online Marketing Business Partners
Your Online Marketing Business
Opportunity
|