Geeklog Usage Stats Plugin [v1.2.0]
by Andy Maloney [asmaloney@users.sf.net]
08 May 2005
Table of Contents
Description
The Geeklog Usage Stats [GUS] plugin collects statistics on who visits your site, what browser and operating system
they are using, which pages they view, and which links they are clicking to get there. It allows the administrator
to browse these stats through a series of tables, getting right down into the data. It is based on the
venerable stats plugin v1.3
by Tom Willett and John Hughes. Some of this documentation is based on their work as well. I was using
the stats plugin for a long time and eventually decided it needed some cleanup and
updating to work with the latest version of geeklog. Tom mentioned he wasn't going to continue supporting it, so I
thought I'd make a few changes myself and release them. I figured this was going to be a quick week's work - wrong!
As I got into it, I found I wanted to fix this and... oh that while I'm here, and optimise this
a bit... oh and tweak that...
Eventually I decided to do a major overhaul.
Differences Between GUS and 'Stats'
I made the following changes to the database:
- moved user agents to their own table
- use the SQL date and time formats
- removed redundant fields
I also changed the name of the plugin from 'stats' to 'gus', eliminated the
'name the plugin whatever you want' functionality, put all the documentation in this readme,
added the ability to import stats from the stats plugin, and changed the installation/upgrade mechanism.
I probably did some other things here and there too...
The changes to the database will improve performance and require less space. I don't have any
real statistics on this, but from the feedback I got from the testers, it reduces databases to less than
half their size and is noticeably faster when browsing the stats.
Developed Using These Tools
- Geeklog 1.3.11
- PHP 5.0.4 [works under 4.3 or greater]
- MySQL 4.1.11 [works in 4.0.x or greater - two testers have reported that it works under 3.23]
- FireFox 1.0.3
- MacOS X 10.4
Version History
- v1.2.0 [08 May 2005]
- [fix] should now install properly on Geeklog 1.3.12cvs
- [fix] import now works on PHP < 4.2.0
- [fix] fixed typo preventing cleanup in one case when the install failed
- [fix] various HTML cleanups and fixes
- [new] clicking an IP address now takes you to a page where you can:
- lookup the IP using WHOIS
- turn data collection on and off for the IP
- you can ban the IP if you have the ban plugin installed
- see the list of hostnames associated with the IP
- [new] the tables now use CSS
- note that the themes have changed significantly, so if you've made changes
you should look at them carefully
- GUS will look in the <public_html>/gus/css directory for a file named {theme}.css and use it
if it exists. If not, it will use default.css.
- if you have created a CSS file for one of the common themes,
send it to me and I will
include it in future versions of GUS
- v1.1.0 [14 Apr 2005]
- [security fix] fixed a potential javascript injection through the referrer URL
Note: The format of the referrers has been changed to fix this, so all data from 1.0 is invalid
and will have to be removed and re-imported [use the remove data capability on the admin page].
- fixed a problem with URLs not being decoded properly when looking at page views
- fixed a problem with importing user agents containing single quotes
- added proper upgrade functionality
- v1.0.0 [10 Apr 2005]
Thanks!
- Tom Willett and John Hughes for writing the original stats plugin
- Brian Bevel for help testing and the slick icons [www.deliciousironing.com]
- Rick Robinson, Richard Rodriguez, Georg Kowallek, Joseph Anthony, and Tom Willett for help testing
Installing The Plugin
- Backup your Geeklog database because the GUS plugin adds and modifies tables.
You can do this with the built in admin backup facility in the Admin menu.
- Uncompress the GUS plugin archive while in the <geeklog_dir>/plugins directory.
The archive will create a directory called gus.
- In your <public_html> directory, create a directory called gus. Under your
<public_html>/admin/plugins/ directory create a directory called gus.
- Change to your <geeklog_dir>/plugins/gus/ directory.
- Copy the files in the admin directory to the admin/plugins/gus/ directory you created in step 3.
- Copy the files and directories in the public_html directory to the public_html/gus/
directory you created in step 3.
- Go to the plugin administration page. The gus plugin
should show up with a link to install it. Click it. The install page will tell you if the install
was successful or not. If not, examine the Geeklog system errorlog in <geeklog_dir>/logs to see
what the problem was. Fix it and re-install.
- The install page will offer you a link to the import page if it finds a suitable stats plugin to import from.
If you choose not to do this right away, a link will appear on the admin page.
Configuring The Plugin
- In the Admin block you will find a link to the GUS admin page where you may set up ignored
IP addresses, pages, and users. By default the user and IP of the user who installed the plugin is
entered in the ignore list and statistics capture is turned on. The admin page lets you enter additional
users and IPs for which usage information will not be collected. It also allows you to enable and disable
statics capture.
- Set up security. Upon install, only the root users have access to statistics admin and viewing.
You can delegate control for either of these functions through the user and group editors.
- Review the privacy policy. The installation also provides a privacy policy page.
This is controlled by the $_GUS_priv variable in the config.php file. If your
site already has a privacy policy available to your site users, I would encourage you to review it and
see that it is worded so that your site users know what information is being collected about them. If you
allowed anonymous access, a link to the visitor statistics viewer is also added.
- There are several variables in the config.php file which control the display of information [defaults in brackets]:
- $_GUS_Whois - enabling this will create a link to look up the whois info for an IP address [true]
- $_GUS_Whois_URL_start and $_GUS_Whois_URL_end - the URL for the whois lookup [www.whois.sc]
- $_GUS_IMG_name - file name of the 48x48 GUS icon in the public_html/gus/images/ directory [GUS48.png]
- $_GUS_IMG_small_name - file name of the 24x24 GUS icon in the public_html/gus/images/ directory [GUS24.png]
- $_GUS_anon_access - controls whether anonymous users can view summary statistics [0]
- $_GUS_enable_main_menu_GUS - shows a link in the main menu if user has permission to access the stats [0]
- $_GUS_enable_main_menu_privacy_policy - show a link to the privacy policy in the main menu [0]
- $_GUS_user - enables the addition of a 'GUS' link to those members who have view access [1]
- $_GUS_stats - enables extending the regular Geeklog stats page to include 'Unique Visitors' and 'Registered Users' [1]
- $_GUS_phplinks - enable phplinks integration [0]
- $_GUS_sub - set to the subdirectory or subdomain if used [""]
- $_GUS_limit - limit the number of lines to display on some stats reports [25]
- $_GUS_months - number of months displayed on initial page [2]
- $_GUS_days - number of days to show on each page [16]
- $_GUS_cache - enable the caching of stats [false]
- If you are using the custom Who's Online block provided, here's some things to set in config.php [defaults in brackets]:
- $_GUS_fullname - use full name instead of user name [false]
- $_GUS_online - show who's online [true]
- $_GUS_daily - show daily usage statistics [true]
- $_GUS_reg - show registered users [true]
- $_GUS_new - show new users [true]
- $_GUS_refs - show referrers [true]
- $_GUS_max_referrers - the maximum number of referrers to show [100]
- As of version 1.2, GUS uses CSS when displaying the tables. It only includes the CSS file when you are viewing a
GUS page. It first looks in <public_html>/gus/css for a file called {theme}.css - where {theme} is the name of the
current theme. If it doesn't find it, it will use the default.css file included with the plugin. If you have created a
CSS file for one of the common themes, send it to me
and I will include it in future versions of GUS.
Importing Data From Stats
GUS will give you the option to import your data and ignored lists from the stats plugin version 1.3.
You may do this either when you are installing GUS, or from the admin page. If you are going to do this,
I recommend doing it as soon as you install GUS because if there are problems with the import, it may be
difficult to recover.
Note that GUS does not use any of the tables from the stats plugin after the data has been imported,
so it is safe to remove the stats plugin and all its tables.
Removing The Plugin
- Because the plugin modifies several database tables, it should always be removed through the interface provided.
Log in to your Geeklog as a root user and go to the plugin administration page. Click the 'gus'
link and then click the 'Delete' button. It will ask you to confirm it. Confirm it.
- Delete the three plugin directories created in the install process:
- <geeklog-dir>plugins/gus/
- <public_html>/gus/
- <admin>/plugins/gus/
- There is no step three.
Things You Can Do
- Check my PHP & SQL and tell me if there are better ways to do any of this.
[email me]
- Let me know if you use it or have any suggestions.
[email me]
- Link to my site [http://imol.gotdns.com] somewhere on yours.
- Support development by making a donation:
or by using one of the following links to shop at amazon:
or by going to [http://imol.gotdns.com] and clicking on an interesting Google ad or two
[I make several cents for each click]
License
The GUS plugin is licensed under the GPL even though I don't really understand it and all its implications. Why do we let legalese control the world?