WordPress MU plugin: WibStats

Wibstats is a stats plugin developed for the Wibsite. It stores visitor information on a per-blog basis and gives several reports to the user. Wibstats has been greatly enhanced for version 0.3, some screenshots are below showing many of the different reports available. In a nutshell Wibstats gives you:

  • Unique visitors and number of pages viewed ever, in the last 28 days, in the last 7 days, and in the last 24 hours
  • Percentage change for date ranges (for example, the percentage change in visitors between the last 24 hours and the preceedding 24 hours)
  • Number of visitors and pages viewed each day
  • Recent search words which brought people to your blog
  • Most popular search words
  • Recent visitor locations (country and city)
  • Most popular visitor locations (country)
  • Most popular pages viewed
  • Most popular platforms (that’s the visitors operating system, like Windows, or something much better like Linux)
  • Most popular browser
  • Most popular screen sizes
  • View of an individual visitor session, showing their origin and search words (if any), computer environment, pages they visited, and whether their IP address has visited your blog before
  • Maps! Maps to show number of visitors by country, recent visitors and more

Screenshots

The main screen is chock-full of statty goodness:

Main stats page
  • Number of unique visitors, and the percentage change
  • Visitors and page views in the last 24 hours, 14 days and 12 weeks
  • Last 50 visitors and their locations
  • New search terms in the last week
  • New visitor locations in the last week

The searches report shows the number of people visiting your blog from a search engine results page (in the last 24 hours, 14 days and 12 wek). It also shows the last 10 search words used, and the 10 most popular search words (longer lists are available for both of these):

Searches

Each search term has it’s own report, showing the number of visitors and page views (last 24 hours, 14 days and 12 weeks). You can also see the countries visiting for this search term, and which domains sent visitors using the search term.

Search term report

The referrers report shows the number of people visiting your blog (last 24 hours, 14 days and 12 weeks) where they have come from a link on another website (not a search engine). The last 10 referrers and 10 most popular referrers are shown, and longer lists of both of those are available.

Referrers

And there’s a report for direct visitors (ones where they have you as a favourite, or they typed your address in directly). Again, last 24 hours, 14 days and 12 weeks. This report also shows the last 10 direct visitors, and the 10 most popular countries for direct visitors.

Direct visitors

Visitor locations shows where people have come from. There are two maps available: visitors by country (how many people have visited from each country) and last 50 visitors.

Visitor locations

The recent visitor map shows the last 50 people visiting your site for whom the system could determine their geographic location. It’s not perfect, and it’s also not possible to get the location of every visitor, but maps are always cool. Click an icon to see the details for that visitor (and go to their session report … more on that later).

Recent visitor map

The content viewed report shows what pages in your blog are most popular. The last 10 pages viewed (with a longer list) and 10 most popular pages (with a longer list) are shown.

Pages report

Each page on your blog also has it’s own report, showing the number of visitors and views (last 24 hours, 14 days, 12 weeks). You can also see what countries have been visiting the page, and the most popular search terms which brought people to that page.

Page views report

For the geeks among us there’s also a report showing the visitors environment – browser, operating system and screen size. If you see lots of visitors with large monitors, running Apple computers, you know you have a rich set of viewers.

Visitor environment

Finally there is a session report which shows you all you want to know about an individual visitor. Where they came from, their search words, their location (if it could be got), their environment and the pages they viewed. It even shows a list of other sessions from the same IP address, so you can get all Big Brother on them.

Session report

Geo-location information is provided by the free APIs by hostip.info, iplocationtools.com, ipmango.com and pidgets.com, to whom I extend my grateful thanks. A random API from the list is chosen for each session to try to spread the load, but please visit and enter your location (if it’s not correct) and think about donating – especially if your site is busy and will cause a lot of load on their servers.

Browser information is got using JavaScript guru PPK’s script, and the JavaScript is minified using jsmin.php, a PHP implementation of Douglas Crockford’s JSMin to keep your page light.

Please note: Wibstats requires the wp_footer action to be used in your page – so if it isn’t there (normally in your footer.php file) please add it or you won’t get stats.

Installation

Just put it in /wp-content/mu-plugins/, no configuration should be necessary. Please ensure the database user your WPMU system uses has “create table” rights. If the statistics table isn’t created automatically you will need to run this script, inserting your database table prefix and the blog ID in the correct places:

CREATE TABLE [base_prefix]_[blog_id]_wibstats (
id mediumint(9) NOT NULL AUTO_INCREMENT,
timestamp bigint(11),
page VARCHAR(255),
title varchar(255),
ipaddress VARCHAR(24),
sessionid VARCHAR(24),
colordepth VARCHAR(3),
screensize VARCHAR(12),
browser VARCHAR(50),
version VARCHAR(12),
platform VARCHAR(50),
referrer VARCHAR(255),
referrer_domain VARCHAR(255),
terms VARCHAR(255),
city VARCHAR(50),
country VARCHAR(50),
countrycode VARCHAR(3),
PRIMARY KEY  (id)
);

Future development aims include:

  • Using several different geo-location APIs randomly chose for each session; this will lighten the load on hostip.info – done!
  • More reports (such as popular days of the week and hours of the day), and some customisable ones allowing the user to slice and dice their visitor info
  • Ability for the user to set their own time zone
  • Perhaps use of SVG for browsers that support it for graphs
  • Indexes on the stats table so when it gets large it doesn’t kill your database

The plugin is available for download from my page in the official WordPress plugin repository.

History

0.3: September 6, 2009: Added Google maps, visitor and page view percentage change numbers, view by referrer/search term/page/visitor environment, session report and many more improvements

0.2: June 7, 2009: Added iplocationtools.com and ipmango.com geolocation APIs. Plugin now hosted in the official WordPress plugin repository.

One Response to “WordPress MU plugin: WibStats”

Leave a Reply

You must be logged in to post a comment.