Advertisment

AWStats: Site Visitor Analysis 

author-image
PCQ Bureau
New Update

AWStats is an open-source, real-time, Web-based tool to analyze visitors to your website. Made in Perl, it is available for both Windows and Linux. On Windows, it can run on both IIS and Apache, while on Linux it uses the Apache Web server. We have provided both AWStats and the Perl compiler on this month's Essential CD.

Advertisment

In AWStats, statistics are displayed as bar graphs wherever possible, and you get a variety of comparative figures such as daily/monthly/weekly visits, listing of the countries (based on their IP addresses) the visitors came from and so on. It also lists the time each visitor spent on one page, and whether the page was accessed through the user's browser 'Favorites'. However, you have to install AWStats' files for each website you want to analyze. You also have to manually edit the AWStats configuration file to set up a couple of parameters and configure directory permissions, if installed on NTFS drives.

Direct Hit!
Applies

to:
Mid-sized businesses
USP:

Install and configure AWStats on Windows Server 2003 and Win XP to analyze visitors to websites
Links:

http://sourceforge.net/projects/awstats 
On PCQ Essential CD:

System/labs/implementation/awstats-61.exe,

System/labs/implementation/ ActivePerl-5.8.4.810-MSWin32-x86.msi

In this article, we will show you how to install and configure this package on the Windows/IIS platform. From the PCQuest CD, copy both Perl and AWStats (EXE files) to a temporary folder on your Windows Server 2003 system's hard disk (C:\Temp). Launch the Perl installer and follow the steps to install it-there is no need to change any options. It is installed by default in

C:\Perl.

Advertisment

Perl is automatically installed into IIS as well. But it needs to be enabled, if you are on Windows Server 2003. Skip this step if you're on Win XP or Win 2000. For this, go to Start>Settings>Control Panel>Administrative Tools and open the IIS Manager. Select the 'Web Service Extensions' folder and on the right-side list, click on the Perl CGI item and then on the Allow button. Do the same for the Perl ISAPI item. With this, Perl is set up to run on any website that you are running on this IIS box.

While here, right click on each website you want to set up AWStats for. Select Properties under Logging, click on the Advanced button and note down the name of the website, full path and name of the log file as displayed there on a piece of paper.

To install AWStats, double click on the AWStats installer (back in C:\Temp) and leave all options at default. At the end of the installation, a configuration script should start up. If it does not happen, then execute 'configure.pl' from C:\Program Files\AWStats\ Tools.This script will not detect your IIS, but will create the initial configuration file. The first step of the wizard prompts you for the path to Apache. Here type 'none' and press Enter. Next, when you are asked if you want to create a new config file, press 'y' and then Enter. When you are required to enter the full DNS name of your website (for which you're now configuring AWStats), enter the website name (say 'localhost') and press Enter. Read the next two sets of messages carefully and press Enter (for each) to finish.

Advertisment

This file is placed in the Program Files>AWStats>wwwroot>cgi-bin and is called AWStats.HOSTNAME. conf (where 'HOSTNAME' is the DNS name of your server). Run the configure.pl script, once, for each website that you have, each time just specifying a different website name at its second prompt. This completes the basic configuration of your system.

Configuring AWStats



This is the most complex part of the installation. To make it easier, create a folder on your desktop called Stats. Now go to the Program Files>AWStats>wwwroot>Cgi-bin folder and copy the following files and folders: Awstats.pl, Lang, Lib, Plugins and Awstats.hostname.conf to the Stats folder. Rename the 'awstats.hostname.conf' file to 'awstats.conf'. From the AWStats\wwwroot folder, copy the folder called Icon as well. Copy the Stats folder to each website you want to enable AWStats for. From Administrative Tools>Services, restart the 'World Wide Web Publishing Service'.

Detailed reporting of who came, from where and visited which pages for how long

Advertisment

Next drag and drop the awstats.conf file in the Stats folder of each website (as copied above) into a Notepad window and follow the steps given below.

  • Drag and drop the log file of this website into another window of Notepad. Find the line starting '#Fields:' (fourth line from the top) and copy (Ctrl+C) all the text on that line, but without the '#Fields:' part. You can close this window now.
  • Find the line (Ctrl+G, type 114, ) in the awstats.conf file that starts 'LogFormat=', delete all the text on that line after the '=' and paste the copied text there. Put double quotes around it, and make sure there are no spaces just after the first double quote and before the second one. Your string should look something like this:

LogFormat="date time cs-method cs-uri-stem cs-uri-query cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes"

Advertisment
  • Now find the 'LogFile=' line (Ctrl+G, 51, ), delete the number you see there-that's for Apache and won't work with IIS. Instead, place a set of double quotes and enter/paste in the full path to the log file for that website (from what you noted on the paper before).

LogFile="C:/Inetpub/wwwroot/test/_logs/W3SVC2018968233/extend1.log"

  • Now, find two lines starting with 'DirCgi' and 'DirIcons' (Ctrl+G and 201 and 211 respectively) and place a '.' inside the double quotes. Also change 'cgi-bin' to 'stats'.
Advertisment

DirCgi="./stats"



DirIcons="./icons"

  • Finally, find 'AllowUpdateStatsFromBrowser' (Ctrl+G, 228) and set the value there to '1'. This will enable you to click on a link on the Web-stats page on your browser to update the data.

Feel free to modify any other parameters as you see fit; there is plenty of documentation just above each option to help you with the options. AWStats is now configured.

Advertisment

Setting IIS permissions



We need to revisit the IIS Manager to set up access permissions for AWStats. So, fire it up again. This time, expand a website and select the Stats folder. Right click on it and select Properties and go to the Home Directory tab. Check on: Source Access and Write. From the Application section toward the bottom, select 'Scripts and Executables' from the drop down. When you get a warning, select Yes. Click on OK. Again, restart the www service.

Analyzing your websites



Fire up your Web browser (from any system on your network if you have a LAN) and access any of your websites on this server, with a '/stats/awstats.pl' at the end:

http://localhost/project1/ stats/awstats.pl

You should not get any errors, but if you do, then the error message also details what you need to do. When everything is okay, click on the 'Update Now' link at the very top of the right-side panel to update.

Sujay V. Sarma

Advertisment