| 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 to | | | | databasecn.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 a | | | | the square brackets for greater than or less than |
| Microsoft Access database. I basically created the | | | | symbols) |
| database in Microsoft Access and called the database | | | | The 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 store | | | | the database in that position, anyone who visits your |
| the data. The table in the database will be called | | | | website could in fact download your statistics. Apart |
| "tblStatistics". The table needs five fields and the | | | | from that this code will not work. The danger of |
| names are:fldPageName DataType - Text 255 | | | | allowing someone access to your web statistics |
| CharactersfldIPNumber DataType - Text 255 | | | | database is that your competitors could find out who is |
| CharactersfldAll_Http DataType - MemofldAll_Raw | | | | visiting 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 of | | | | going on with your website. In the field fldPagename |
| fields each field should be set to and some specific | | | | the actual page that a person is visiting is stored. In the |
| field properties which will be important for this code to | | | | field fldipnumber the IP number of the visitor is stored. |
| work. You will note that there are no primary key | | | | Between these two pieces of information you can find |
| fields. The reason this is undertaken is that the | | | | out how a person has entered the site, what they |
| AutoNumber function in Microsoft Access is to limiting | | | | have 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 called | | | | before they moved onto the next one. |
| fldTimestamp. This field allows you to store the exact | | | | The 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 hosting | | | | what 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 need | | | | conjunction with the IP Database we can work out |
| to get the information into the database. The first thing | | | | from what countries people are visiting our website. |
| you need is to ensure that your provider can in fact | | | | We can get detailed information to the point of which |
| support ASP (Active Server Pages) pages. Most web | | | | cities and even the ISP's who are providing the IP |
| hosting companies can support them, but it is worth | | | | Numbers. 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 that | | | | attributes that are standard for that country. |
| will log information on who is visiting your website and | | | | Using a Microsoft Access Database as your |
| also which websites were referrers and the browsers | | | | datastore means that you can manipulate the data |
| they were using and what language they were | | | | and filter it to find out how people are visiting your |
| searching in. You will find out all this information in both | | | | website 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 top | | | | fields 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 next | | | | browsers interpret HTML in exactly the same way. So |
| '[-----------------WEBLOGGING | | | | if 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 stripdim | | | | Browser then you would be developing your website |
| strAll_http,strremote_addr,strall_raw | | | | for this customer base and browser. If 90% of your |
| ' The Field Below Tells you the page they | | | | customers 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 Numbersstrip | | | | these 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 the | | | | that will help you analyze the logs even further than |
| website | | | | what 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")set | | | | tell you everything about your visitors and whether or |
| cn=server.createobject("adodb.connection") | | | | not your SEO Strategies are in fact working. |