Extension:WSStats: Difference between revisions
No edit summary |
m source --> syntaxhighlight |
||
| Line 58: | Line 58: | ||
Start with: |
Start with: |
||
< |
<syntaxhighlight lang="php"> |
||
$wgWSStats=array(); |
$wgWSStats=array(); |
||
</syntaxhighlight> |
|||
</source> |
|||
Allow statistics for anonymous users.. |
Allow statistics for anonymous users.. |
||
< |
<syntaxhighlight lang="php"> |
||
//Record anonymous users |
//Record anonymous users |
||
$wgWSStats['skip_anonymous']=false; |
$wgWSStats['skip_anonymous']=false; |
||
</syntaxhighlight> |
|||
</source> |
|||
Skip users in the following groups.. |
Skip users in the following groups.. |
||
< |
<syntaxhighlight lang="php"> |
||
//Skip if user is in following groups |
//Skip if user is in following groups |
||
$wgWSStats['skip_user_groups'][]='sysop'; |
$wgWSStats['skip_user_groups'][]='sysop'; |
||
$wgWSStats['skip_user_groups'][]='admin'; |
$wgWSStats['skip_user_groups'][]='admin'; |
||
</syntaxhighlight> |
|||
</source> |
|||
Count all hits.. |
Count all hits.. |
||
< |
<syntaxhighlight lang="php"> |
||
$wgWSStats = array(); |
$wgWSStats = array(); |
||
$wgWSStats['count_all_usergroups'] = true; |
$wgWSStats['count_all_usergroups'] = true; |
||
</syntaxhighlight> |
|||
</source> |
|||
{{note|1=If you have set $wgWSStats['count_all']=true; then $wgWSStats['skip_user_groups'] is ignored.}} |
{{note|1=If you have set $wgWSStats['count_all']=true; then $wgWSStats['skip_user_groups'] is ignored.}} |
||
| Line 88: | Line 88: | ||
Skip page with certain text in their referer url. Default action=edit and veaction=edit are ignored. This configuration option is case sensitive. |
Skip page with certain text in their referer url. Default action=edit and veaction=edit are ignored. This configuration option is case sensitive. |
||
< |
<syntaxhighlight lang="php"> |
||
$wgWSStats['ignore_in_url'][] = 'Template:Test'; |
$wgWSStats['ignore_in_url'][] = 'Template:Test'; |
||
$wgWSStats['ignore_in_url'][] = 'action=edit'; |
$wgWSStats['ignore_in_url'][] = 'action=edit'; |
||
</syntaxhighlight> |
|||
</source> |
|||
== Using the parser functions == |
== Using the parser functions == |
||
Revision as of 13:01, 28 July 2020
Release status: beta |
|
|---|---|
| Implementation | Parser extension |
| Description | Collect page statistics |
| Author(s) | Sen-Sai |
| Latest version | 0.1.7 |
| MediaWiki | |
| Database changes | Yes |
| Composer | wikibase-solutions/w-s-stats |
|
$wgWSSStats |
|
|
wikibasesolutions |
|
| Licence | GNU General Public License 2.0 or later |
| Download | GitHub:
Note: [README] |
WSStats extension counts pageviews by user
- 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
WSStatsin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
require_once "$IP/extensions/WSStats/WSStats.php";
- Run the update script which will automatically create the necessary database tables that this extension needs.
Done – Navigate to Special:Versionon 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;
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}}
If no statistics the result will be 0
- Beta status extensions
- Parser extensions
- Extensions supporting Composer
- ParserFirstCallInit extensions
- BeforePageDisplay extensions
- LoadExtensionSchemaUpdates extensions
- GPL licensed extensions
- Extensions in GitHub version control
- All extensions
- Extensions not using extension registration
- Extensions by Wikibase Solutions
