Extension:PageViewInfo
PageViewInfo Release status: stable |
|
---|---|
Implementation | MyWiki |
Description | Provides fancy looking graphs of Wikimedia page view data |
Author(s) | Kunal Mehta (Legoktmtalk) |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | 1.29+ |
PHP | 5.5+ |
Database changes | No |
License | GNU General Public License 3.0 or later |
Download | |
|
|
MediaWiki\Extensions\PageViewInfo\PageViewService
|
|
Quarterly downloads | 31 (Ranked 103rd) |
Public wikis using | 867 (Ranked 295th) |
Translate the PageViewInfo extension if it is available at translatewiki.net | |
Vagrant role | pageviewinfo |
Issues | Open tasks · Report a bug |
The PageViewInfo extension provides API modules to access pageview-related data and adds fancy looking graphs to the "Page information" interface.
It does not do any data collection or storage itself; it relies on the PageViewService
class which needs to be implemented for each data collection backend.
Installation
[edit]- Requires Graph extension if you want to see the fancy graphs
- Download and move the extracted
PageViewInfo
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/PageViewInfo - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'PageViewInfo' );
- 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 pageviewinfo --provision
Local development
[edit]For local development, you can point the extension at Wikimedia production using the following additions to LocalSettings.php:
$wgPageViewInfoWikimediaDomain = "en.wikipedia.org";
When enabled, visiting MediaWiki?action=info on your local development server will show page views for the MediaWiki article on English Wikipedia rather than on your local site.
When the Graph extension is enabled, clicking the number of page views will open an overlay displaying a graph of page views.
API
[edit]prop=pageviews (pvip)
- This module requires read rights.
- Source: PageViewInfo
- License: GPL-3.0-or-later
Shows per-page pageview data (the number of daily pageviews for each of the last pvipdays days).
The result format is page title (with underscores) => date (Ymd) => count.
- pvipmetric
The metric to use for counting views. Depending on what backend is used, not all metrics might be supported. You can use the siteinfo API (action=query&meta=siteinfo) to check which ones are supported, under pageviewservice-supported-metrics / module name (siteviews, mostviewed, etc.)
- pageviews
- Plain pageviews.
- One of the following values: pageviews
- Default: pageviews
- pvipdays
The number of days to show.
- Type: integer
- The value must be between 1 and 60.
- Default: 60
- pvipcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Show pageview statistics for the main page.
- api.php?action=query&titles=Main_Page&prop=pageviews [open in sandbox]
meta=siteviews (pvis)
- This module requires read rights.
- Source: PageViewInfo
- License: GPL-3.0-or-later
Shows sitewide pageview data (daily pageview totals for each of the last pvisdays days).
The result format is date (Ymd) => count.
- pvismetric
The metric to use for counting views. Depending on what backend is used, not all metrics might be supported. You can use the siteinfo API (action=query&meta=siteinfo) to check which ones are supported, under pageviewservice-supported-metrics / module name (siteviews, mostviewed, etc.)
- pageviews
- Plain pageviews.
- uniques
- Unique visitors.
- One of the following values: pageviews, uniques
- Default: pageviews
- pvisdays
The number of days to show.
- Type: integer
- The value must be between 1 and 60.
- Default: 60
- Show sitewide pageview totals.
- api.php?action=query&meta=siteviews [open in sandbox]
- Show sitewide unique visitor totals.
- api.php?action=query&meta=siteviews&pvismetric=uniques [open in sandbox]
list=mostviewed (pvim)
- This module requires read rights.
- This module can be used as a generator.
- Source: PageViewInfo
- License: GPL-3.0-or-later
Lists the most viewed pages (based on last day's pageview count).
- pvimmetric
The metric to use for counting views. Depending on what backend is used, not all metrics might be supported. You can use the siteinfo API (action=query&meta=siteinfo) to check which ones are supported, under pageviewservice-supported-metrics / module name (siteviews, mostviewed, etc.)
- pageviews
- Plain pageviews.
- One of the following values: pageviews
- Default: pageviews
- pvimlimit
The number of pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- pvimoffset
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Type: integer
- Default: 0
- List the top 10 pages.
- api.php?action=query&list=mostviewed [open in sandbox]
- Show pageview data for each of the top 10 pages.
- api.php?action=query&generator=mostviewed&prop=pageviews [open in sandbox]
Community Integration
[edit]Currently, PageViewService
class is only implemented for the Wikimedia Pageview API in this extension. You must install an additional, community-maintained extension to use other data collection backend.
- Extension:PageViewInfoGA - Supports Google Analytics integration.
- Extension:Plausible
If you implemented your own PageViewService
, please list it here.
See also
[edit]This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |