In my last post, I detailed the way in which you could activate the Analog statistics application on DreamHost accounts with root WordPress installations. I’m really not a fan of Analog, though – my preferred application for statistics tracking is Webalizer.
I’ll describe the best way to install Webalizer in this shared hosting environment, with information distilled from the DreamHost Customer Support Wiki.
First, you’ll need shell (SSH) access to your Dreamhost account. Once you’ve logged in, carry out the following tasks:
- Make a new directory in your home path called webalizer. Also make a new directory for your domain’s statistics.
- Change to the directory.
- Open a new links browser instance to the Webalizer download page.
- When Links opens, press Enter to bypass the information box if it appears.
- Arrow down to the Linux ELF – Binary x86 link. (You don’t need the static binary.) Press d to download the file, and then press Enter to save the .tgz file.
- Once the file is downloaded, press q and then Enter to exit Links.
- Extract the .tgz file (change the version number if necessary).
tar -zxf webalizer-2.01-10-linuxelf-x86-bin.tgz
- Move the contents of the versioned Webalizer directory to the ~/webalizer directory, and delete the version numbered extraction directory.
mv webalizer-2.01-10-linuxelf-x86/* .
rm -rf webalizer-2.01-10-linuxelf-x86/
- Copy the sample.conf file to a new file with your domain name.
cp sample.conf example.com.conf
- Edit the example.com.conf file using your preferred editor. You will want to uncomment and change the following lines to reflect the DreamHost configuration:
TheLogFile line should read:
The OutputDir command should be:
The Incremental option should be enabled:
And the IncrementalName directive should be uncommented:
- Save the file, then run the webalizer application:
./webalizer -c example.com.conf
- Browse to your site’s webalizer directory and view the statistics. The URL is:
In order to retrieve each day’s statistics and have Webalizer parse them, you need to set up a cronjob to automatically run each day after midnight. 2 AM is about the best bet for the cycle to run.
- Set your EDITOR variable to vi, so that your commands all are on the same line.
- Edit your crontab file:
- Add the following line to the crontab file. (Press i for Insert mode to begin typing in vi. To exit, type :wq.)
0 2 * * * /home/username/webalizer/webalizer -c /home/username/webalizer/example.com.conf >/dev/null 2>&1
Your cronjob will now run at 2AM every day, processing the previous day’s log entries.
If you want to secure your /webalizer/ directory from prying eyes, you can create a .htaccess file under ~/example.com/webalizer/ with the following information:
AuthName "Webalizer Statistics"
Then, use Apache’s htpasswd tool to create the .htpasswd file:
htpasswd -c /home/username/example.com.stats.htpasswd useraccount
You will be prompted for a password for the user account. To add more users to this file, run the htpasswd command without the -c flag:
htpasswd /home/username/example.com.stats.htpasswd anotheruser
While there’s a lot of information to digest, Webalizer is an excellent tool for tracking web statistics and the user interface is slightly more friendly than Analog. I plan to use the two applications concurrently – Analog seems to do a better job of tracking referral URLs and Webalizer provides colourful graphs.
Update 3/07/2007: I’ve updated the crontab section to reflect that the full /home/username/webalizer/example.com.conf path needs to be passed for the -c flag.