Release status: beta
|Implementation||Database, Data extraction|
|Description||Provide the page views functionality|
|Author(s)||Mark A. Hershberger (MarkAHershbergertalk)|
|License||GNU General Public License 3.0 or later|
|Translate the HitCounters extension if it is available at translatewiki.net|
|Check usage and version matrix.|
|Issues||Open tasks · Report a bug|
The HitCounters extension provides the page views functionality that was removed in MediaWiki 1.25. HitCounters displays the view count in the page footer and the most popular pages on a special page called Special:PopularPages.
If you want to update MediaWiki to version 1.26, currently the following steps have to be done in order to prevent loss of hitcounter numbers:
- Use MediaWiki 1.25 and install this extension.
- Still in MediaWiki 1.25, run update.php. This step is mandatory! This should migrate the hitcounter data to the new locations:
- Table hit_counter should exist and should contain all the hit numbers
- Table hit_counter_extension should exist (and possibly contain information on the few, newest hits)
- Note that I have not tested if this actually works! The SQL files, which are included with the HitCounters extension, demonstrate the SQL commands, which have to be run before(!) running update.php in MediaWiki 1.26, in order to preserve the existing data.
- After the above steps, update to MediaWiki 1.26 or newer. Running update.php in that version will still remove hitcounter data from the old locations, as far as it is still present there. However, since you have done the migration, the extension should continue working!
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'HitCounters' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Differences from 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 done in a more lightweight way in order to speed up processing time. Many lines of superfluous code were removed. Also, the old MediaWiki core code did numerous database queries on every page hit; these have all been removed as well. This change may possibly lead to some inaccuracies in the data.
The core differences that wiki administrators need to know are:
- The hit counts are stored in cache.
- The visible hit count at the bottom of each page is updated only once per day. (Pages with hit count less than 100 are updated once per minute.)
- If you refresh your browser on a wiki page, that hit is ignored.
Special page aliases should be created in HitCounters.i18n.magic.php, and magic word aliases in HitCounters.i18n.magic.php.
I need bug reports in Phabricator so that they can be worked on. If you run into a problem with one of the following, please create a phabricator task and link to it here. -- ☠MarkAHershberger☢(talk)☣ 16:02, 30 July 2016 (UTC)
This extension currently confuses the display of accesses for pages with the same name across namespaces. See task T163957 for further information.
- Extension:GoogleAnalyticsMetrics - Provides site-wide metrics for Google Analytics users