From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: beta
Implementation Parser extension
Description Collect page statistics
Author(s) Sen-Sai
Latest version 0.1.5
Database changes Yes
License GNU General Public License 2.0 or later
Download Download Git master
Project page
Translate the WSStats extension if it is available at translatewiki.net
Check usage and version matrix.

WSStats extension counts pageviews by user

  • Version 0.1.5 : Added more configuration options
  • Version 0.1.3 : Fixed error in MySQL
  • Version 0.1.2 : Skip usergroup results
  • Version 0.1.1 : Initial release


  • Download and place the file(s) in a directory called WSStats in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/WSStats/WSStats.php";
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

By default Anonymous users and sysops are skipped from stats recording. To change this add following to LocalSettings.php..

Start with :


Allow statistics for anonymous users..

//Record anonymous users $wgWSStats['skip_anonymous']=false;

Skip users in the following groups..

//Skip if user is in following groups $wgWSStats['skip_user_groups'][]='sysop'; $wgWSStats['skip_user_groups'][]='admin';

Count all hits..

$wgWSStats = array(); $wgWSStats['count_all_usergroups'] = true;

NOTE: If you have set $wgWSStats['count_all']=true; then $wgWSStats['skip_user_groups'] is ignored.

Skip page with certain text in their referer url. Default action=edit and veaction=edit are ignored. This configuration option is case sensitive.

$wgWSStats['ignore_in_url'][] = 'Template:Test';
$wgWSStats['ignore_in_url'][] = 'action=edit';

Using the parser functions[edit]

To retrieve statistics you can use the following parser function :

Ask number of hits for page id : 9868


Ask number of hits for page id : 714 since start date 2018-09-01

|start date=2018-09-01}}

Ask number of hits for page id : 714 since start date 2018-02-01 and end date 2018-09-08

|start date=2018-02-01|end date=2018-09-08}}

If no statistics the result will be 0