Jump to content

Extension:WSStats: Difference between revisions

From mediawiki.org
Content deleted Content added
Running on several server for over a year. Considered stable.
m author addition
Line 9: Line 9:
|newhook1=<!-- hooks added by the extension, see [[Template:Extension]] for details -->
|newhook1=<!-- hooks added by the extension, see [[Template:Extension]] for details -->
|newhook2=
|newhook2=
|username=<!-- optional, but strongly recommended -->
|username=Sen-Sai
|author=[https://www.wikibase-solutions.com/author/charlot Charlot Cobben]
|author=[[User:Sen-Sai|Sen-Sai]]
|description=Collect page statistics
|description=Collect page statistics
|image=
|image=

Revision as of 09:08, 15 December 2021

MediaWiki extensions manual
WSStats
Release status: stable
Implementation Parser extension
Description Collect page statistics
Author(s) Charlot Cobben (Sen-Saitalk)
Latest version 0.8.1
MediaWiki
Database changes Yes
Composer wikibase-solutions/w-s-stats
$wgWSSStats
wikibasesolutions
Licence GNU General Public License 2.0 or later
Download
[README]

WSStats extension counts pageviews by user

  • Version 0.8.1 : adminlinks added
  • Version 0.8.0 : Clean Up
  • Version 0.1.9 : Fetch Title changes
  • Version 0.1.8 : Removed dbprefix class variable
  • Version 0.1.7 : Show top visited pages with date range. Show as csv option
  • Version 0.1.6 : Filter results on user or anonymous
  • 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

Installation

  • 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 file:
    wfLoadExtension( 'WSStats' );
    
  • 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

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

Start with:

$wgWSStats=array();

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;
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

To retrieve statistics you can use the following parser function :

Ask number of hits for page id : 9868

{{#wsstats:id=9868}}

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

{{#wsstats:id=714
|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

{{#wsstats:id=714
|start date=2018-02-01|end date=2018-09-08}}

Filter results on registered users or anonymous users

{{#wsstats:id=714
|start date=2018-02-01
|end date=2018-02-08
|type=only anonymous}}
{{#wsstats:id=714
|start date=2018-02-01
|end date=2018-02-08
|type=only user}}

Get the top ten pages sorted by hits

{{#wsstats:stats}}

Get the top ten pages sorted by hits in a date range

{{#wsstats:stats
|start date=2018-02-01
|end date=2018-02-08}}

Get the top ten pages sorted by hits and show as csv

{{#wsstats:stats
|format:csv}}

If no statistics the result will be 0