Extension:Usage Statistics

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Usage Statistics

Release status:Extension status unmaintained

Extension Usage Statistics - NSselector add-on.png
ImplementationTemplate:Extension#type Special page, Database, User rights
DescriptionTemplate:Extension#description View usage statistics on per user basis and the site as a whole
Author(s)Template:Extension#username Paul Grinberg
Latest versionTemplate:Extension#version v1.12.0 (2009-05-20)
MediaWikiTemplate:Extension#mediawiki 1.7.3+ (and probably much earlier)
LicenseTemplate:Extension#license GPL
Download Template:WikimediaDownload/svn
Read changelog
Added rightsTemplate:Extension#rights


Translate the Usage Statistics extension if it is available at translatewiki.net

Check usage and version matrix.


It is usually interesting to find out how you, as a user of the wiki have been performing over time. Just as interesting for wiki admins, is to find out how the wiki has been growing over time. This extension provide the capability to view this data in a graphical form. Note: currently, this extension has the limitation of being a bit slow in processing the data which may cause it to time out in cases of >100k pages.


The output is a graph of the user's usage:

  1. Edits - the total number of times, including today, the user has edited any page. This should be equivalent to the number of times the user pressed the Save Page button when editing
  2. Pages - the total number of unique pages, including today, the user has edited. The previous column could have a very large number if the user prefers the Save Page button instead of the Show Preview button. In other words, a user can have a large number of edits for a single page. The value in this column will always be less than or equal to the Edit line.

Installation Instructions[edit]

Step 1[edit]

Download the extension code by downloading the four files listed here. Browse to each file, click "View Raw File", and download the resulting file to the extensions/UsageStatistics/ directory.

Step 2[edit]

Add the following text to your LocalSettings.php

require_once( "$IP/extensions/UsageStatistics/UsageStatistics.php" );

For some older versions of the extension it may instead be this:

require_once( "$IP/extensions/UsageStatistics/SpecialUserStats.php" );

Step 3[edit]

By default, the extension uses the Extension:Gnuplot for generating graphs. However, on some wikis it may not be possible to install the gnuplot program which the extension utilizes. Therefore, this extension can also use the little known Google Charts. There are trade-offs for both options:

Pros Cons
  • Faster
  • Does not require access to outside world
  • Does not require down sampling of data
  • Requires admin access on server to install gnuplot if not already available
Google Charts
  • Does not require admin access on server to install gnuplot
  • May be configured to be prettier
  • Slower
  • Requires access to google.com
  • Requires down sampling of data
  • Can be avoided by disabled javascript

Gnuplot Extension option[edit]

If you decide to go the gnuplot way, then follow the installation instructions to install the GNUPlot extension.

Google Charts options[edit]

If you decide to go the Google Charts option, then add

$wgUserStatsGoogleCharts = 1;

in LocalSettings.php after the call to require_once() for the extension.

Step 4[edit]

Log in as a user with administrative priviledges and go to your wiki's page entitled MediaWiki:Common.js. Make sure that this page contains a section on Dynamic Navigation Bars. If it does not, then you can copy it from Wikipedia wikipedia:MediaWiki:Common.js. It is highly recommended that if your wiki's page did not exist, that you copy the entire contents over from Wikipedia.

Next, go to your wiki's page entitled MediaWiki:Common.css. Make sure that this page contains definitions for NavFrame and all of the associated declarations. If it does not, then you can copy it from Wikipedia wikipedia:MediaWiki:Common.css. It is highly recommended that if your wiki's page did not exist, that you copy the entire contents over from Wikipedia.

After you are done, make sure to clear your browser's cache!


There should now be a new Special Page in your Special:Specialpages list called Usage Statistics (Special:UserStats). Go to this page. Select a Start Date, End Date, the interval , and the type (cumulative or incremental) of usage extraction.

Extension Usage Statistics1.png

Click the Generate Statistics button and voila. The output page will contain a graph of usage statistics for the logged in user.

If the logged in user has the viewsystemstats user right (by default, only members of the sysop and manager groups do), then in addition to their personal statistics, they will also see the usage statistics for the entire wiki both in graphical form and CSV raw data form.

Extension Usage Statistics2.png


  • v1.11.5 - May 20, 2009 - add right- message; remove trailing whitespace, update indentation, stylize.php - by User:Siebrand
  • July 14, 2009 - bugzilla:19621 add the possibility to plot statistics concerning a selected namespace excluding redirects.
  • v1.11.4 - April 27, 2009 - localization improvements by User:shinjiman and User:Siebrand
  • v1.11.3 - December 29, 2008 - fix bug in special page aliases; $wgSpecialPageGroups for special page - by User:Siebrand
  • v1.11.2 - October 29, 2008 - made the extension work with MW 1.7.x w.r.t. the use of getWeekdayAbbreviation() method.
  • v1.11.1 - October 3, 2008 - Fixed a problem with older versions of MW
  • v1.11 - October 3, 2008 - added the ability to use Google Charts instead of gnuplot
  • v1.10 - October 2, 2008 - corrected a number of warnings that arise when executing by a user who does not have any edits themselves. Cleaned up the reported HTML errors.
  • v1.9 - Corrected an initialization problem with graph data when users don't have anything to display (thanks to Wolcott)
  • v1.8 - Tim Starling corrected a security bug
  • v1.7
    • fixed a bug in generating day names
    • updated translations
  • v1.6 - February 29, 2008
    • Internationalized month names and weekday names in calendar lookup
    • improved the way detailed statistics are displayed
  • v1.5 - February 20, 2008
    • use wfLoadExtensionMessages() only if it is available and if not (as is the case on some older MW installations), revert back to the old fashioned method of loading messages
    • use a new userright called 'viewsystemstats' to determine with system wide statistics should be displayed
  • v1.4 - February 17, 2008 - uses wfLoadExtensionMessages now for better fallback support and standardised i18n implementation for extensions
  • v1.3 - February 10, 2008 - added more i18n content
  • v1.2 - September 29, 2007 - fixed a bug where MySQL query would get too long when viewing stats for a large number of intervals. Added page statistics to graphs as second Y axis.
  • v1.1 - September 21, 2007 - fixed a bug where the wgDBprefix was hardcoded.
  • v1.0 - September 21, 2007 - published on MediaWiki