SEO - Creating Your Own Basic Web Statistics Database

There are literally thousands of website statistics'This code connects to your databasestrConnect =
systems available on the Internet. Some provide"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
complex analysis, whilst others provide very basic& Server.MapPath
information. Sometimes simply due to whom your web("/_private/dbstatistics.mdb")cn.open(strConnect)
provider is you may not be able to install your own'This code inserts the collected information into your
statistics applications. I will set out in this article todatabasecn.execute "insert into
provide a very basic web statistics database that will)values('" &strPageName & "','" & strip
allow you to catch whom is visiting your web site and& "','" & strall_http & "','" & strall_raw
where they are coming from.& "')"cn.close
The first step in the process of building your own web'[------------------WEBLOGGING END -------------------]
statistics database is to identify where you will store%]
the statistical information you have collected. In this(Please note for the code to work you must substitute
example, I have decided to store all the data in athe square brackets for greater than or less than
Microsoft Access database. I basically created thesymbols)
database in Microsoft Access and called the databaseThe Microsoft Access Database must be stored into
"dbStatistics".the _Private folder on your website. If you do not put
The next step is to build a table in which you will storethe database in that position, anyone who visits your
the data. The table in the database will be calledwebsite could in fact download your statistics. Apart
"tblStatistics". The table needs five fields and thefrom that this code will not work. The danger of
names are:fldPageName DataType - Text 255allowing someone access to your web statistics
CharactersfldIPNumber DataType - Text 255database is that your competitors could find out who is
CharactersfldAll_Http DataType - MemofldAll_Rawvisiting your website and from where and as such this
DataType - MemofldTimestamp DataType -is really a serious business intelligence issue.
DateTime Default Value - Date() & " " &The code shown above has a number of pieces of
time()information that is really useful in working out what is
The information above simply defines the type ofgoing on with your website. In the field fldPagename
fields each field should be set to and some specificthe actual page that a person is visiting is stored. In the
field properties which will be important for this code tofield fldipnumber the IP number of the visitor is stored.
work. You will note that there are no primary keyBetween these two pieces of information you can find
fields. The reason this is undertaken is that theout how a person has entered the site, what they
AutoNumber function in Microsoft Access is to limitinghave visited and also with the field fldTimestamp you
in the volume of data that you can hold.can work out how long they looked at each page
You will also notice that there is a field calledbefore they moved onto the next one.
fldTimestamp. This field allows you to store the exactThe field fldipnumber contains powerful information. On
local Date and Time the person visited your website.the internet there are a number of lists of who owns
The local time is the time on your server that is hostingwhat IP Numbers and also which countries they have
your webpages.been assigned to. By collecting the IP Numbers and in
For this basic web statistic log to work, we now needconjunction with the IP Database we can work out
to get the information into the database. The first thingfrom what countries people are visiting our website.
you need is to ensure that your provider can in factWe can get detailed information to the point of which
support ASP (Active Server Pages) pages. Most webcities and even the ISP's who are providing the IP
hosting companies can support them, but it is worthNumbers. With this information it allows us to setup our
checking.web pages to be in line with the characteristics and
We now need to add the code to each webpage thatattributes that are standard for that country.
will log information on who is visiting your website andUsing a Microsoft Access Database as your
also which websites were referrers and the browsersdatastore means that you can manipulate the data
they were using and what language they wereand filter it to find out how people are visiting your
searching in. You will find out all this information in bothwebsite and who is referring them. This information is
the fldAll_Http and fldAll_Raw fields.stored in the fldAll_Http and fldAll_Raw fields. These
The following code needs to be copied into the topfields will also contain important information such as
part of your webpage before the HTML tag.what browsers and operating systems people are
[%@ Language=VBScript %]using to visit your website. For example not all
[%on error resume nextbrowsers interpret HTML in exactly the same way. So
'[-----------------WEBLOGGINGif you found that 90% of your customers were in fact
START------------------------]dim strpagename,strwho,using the browser SAFARI which is the Apple
stradvertdim cn, strconnectdim stripdimBrowser then you would be developing your website
strAll_http,strremote_addr,strall_rawfor this customer base and browser. If 90% of your
' The Field Below Tells you the page theycustomers were using Firefox then you would develop
visitedstrPageName =your web pages taking into account the idiosyncrasies
request.servervariables("server_name") &of that browser.
request.servervariables("URL")There is a lot of powerful information contained in
'The Field Below Tells you the visitors IP Numbersstripthese logs and I strongly encourage you to get some
= request.servervariables("Remote_Addr")Microsoft Access Database Development Experience
'The fields below contain all the information such as thethat will help you analyze the logs even further than
websitewhat has been discussed in this article.
' that referred them to your page etc.strAll_http =Remember one thing, when it comes to SEO or
request.servervariables("ALL_HTTP")strall_raw =Search Engine Optimization it is the web logs that will
request.servervariables("all_raw")settell you everything about your visitors and whether or
cn=server.createobject("adodb.connection")not your SEO Strategies are in fact working.