Extension:HitCounters
HitCounters Release status: stable |
|
---|---|
Implementation | Database , Data extraction, MyWiki |
Description | Provides a page views functionality |
Author(s) | Mark A. Hershberger (MarkAHershbergertalk) |
Latest version | 0.4 |
MediaWiki | >= 1.36.0 |
PHP | 7.3.19+ |
Database changes | Yes |
Composer | mediawiki/hit-counters |
Tables | hit_counter hit_counter_extension |
License | GNU General Public License 3.0 or later |
Download | |
|
|
hitcounter-exempt |
|
Quarterly downloads | 124 (Ranked 47th) |
Translate the HitCounters extension if it is available at translatewiki.net | |
Vagrant role | hitcounters |
Issues | Open tasks · Report a bug |
The HitCounters extension displays the view count in the page footer and the most viewed pages on a special page called PopularPages. The extension provides page views statistics that were removed in MediaWiki 1.25 .
About
Benefits
This extension provides feedback in the form of audience measurement to editors. Knowing the rough size of one's audience as an editor allows editors to identify and improve popular articles. HitCounters' special page PopularPages also allows editors to focus on improving those articles with the highest traffic and helps readers discover a project's most curated content.
HitCounters extension enables determining the wikiFactor, a rough measure of a wiki website's popularity.
HitCounters extension is minimally intrusive concerning data security and privacy concerns. The extension handles metrics on the server side, so aggregated data stays within the site's security boundary. The extension does not inject JavaScript to be executed by the client and does not ask a client to download additional un-audited code from a third party, like GoogleAnalyticsMetrics .
The extension does not track users who visit a page. As such, there's no need for special handling of "Do Not Track" browser requests or Global Privacy Control settings. The extension also does not use third-party services like the GoogleAnalyticsMetrics extension.
The extension has no dependencies that can cause conflicts. Other extensions, like GoogleAnalyticsMetrics, can cause problems during a Composer update. Also see P6481.
Differences from former core MediaWiki implementation
Before MediaWiki 1.25, the page views counting functionality was in core MediaWiki. This extension is based on that same code but was deliberately made lighter to speed up processing time. Many lines of superfluous code were removed. Also, the old MediaWiki core code performed numerous database queries on every page hit; these have all been removed. This change may lead to some inaccuracies in the data.
The core differences that wiki administrators need to know are:
- The hit counts are stored in the cache.
- The visible hit count at the bottom of each page is updated only once daily. (Pages with a hit count of less than 100 are updated once per minute.)
- That hit is ignored if you refresh your browser on a wiki page.
What counts as view?
According to tests conducted by several MediaWiki operators, a view is counted if a page is accessed (action=view
), as well as action=render
and when accessing a page revision.
A view is not counted with the other actions, such as action=raw
, action=edit
, and action=info
.
Migration
Installation
- Download and move the extracted
HitCounters
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HitCounters - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'HitCounters' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Vagrant installation:
- If using Vagrant , install with
vagrant roles enable hitcounters --provision
Configuration
$wgDisableCounters
- When set to
true
, it disables the notice in the pages footer saying "This page has been accessed 256 times." as well as the special page "PopularPages". The default value isfalse
.
- When set to
$wgHitcounterUpdateFreq
- Sets how often page counters should be updated. The default value is
1
.
- Sets how often page counters should be updated. The default value is
$wgGroupPermissions['sysop']['hitcounter-exempt'] = true;
- Exclude user group page views from counting.
$wgEnableAddPageId
- When set to
true
, it adds thePageId
to the special page "PopularPages". The default value isfalse
.
- When set to
$wgEnableAddTextLength
- When set to
true
, it adds theTextLength
to the special page "PopularPages". The default value isfalse
.
- When set to
Fork
There is a fork of this extension that offers custom settings to the user:
- REL1_38-v0.5.6 is backward compatible with MediaWiki 1.38.0.
See also
- Extension:GoogleAnalyticsMetrics - Provides site-wide metrics for Google Analytics users
- Extension:Analytics - Gives access to traffic and edit analytics for the entire wiki, as well as for specific categories and pages
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Stable extensions/en
- Database extensions/en
- Data extraction extensions/en
- Personalization extensions/en
- Extensions supporting Composer/en
- GPL licensed extensions/en
- Extensions in Wikimedia version control/en
- Extensions which add rights/en
- All extensions/en
- Extensions included in BlueSpice/en
- Extensions included in MyWikis/en
- Extensions included in WikiForge/en
- Statistics extensions/en
- Special page extensions/en