Extension:PageViewInfo

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
PageViewInfo
Release status: beta
PageViewInfo Extension screenshot.png
Implementation MyWiki
Description Provides fancy looking graphs of Wikimedia page view data
Author(s) Kunal Mehta (Legoktmtalk)
Compatibility policy release branches
MediaWiki 1.27+
PHP 5.5+
Database changes No
License GNU General Public License 3.0 or later
Download
Example bf-wmpageview.wmflabs.org
Parameters
  • $PageViewInfoWikimediaEndpoint
  • $PageViewInfoWikimediaDomain
  • $PageViewInfoWikimediaRequestLimit
  • $PageViewApiMaxDays
Services defined
MediaWiki\Extensions\PageViewInfo\PageViewService
Hooks used
InfoAction
ApiQuery::moduleManager
APIQuerySiteInfoGeneralInfo
Translate the PageViewInfo extension if it is available at translatewiki.net
Check usage and version matrix.
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. (Currently it is only implemented for the Wikimedia Pageview API.)

Installation[edit]

  • If using Vagrant , install with vagrant roles enable pageviewinfo --provision
Manual installation
  • Requires Graph extension if you want to see the fancy graphs
  • Download and place the file(s) in a directory called PageViewInfo in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'PageViewInfo' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

API[edit]

prop=pageviews (pvip)

(main | query | pageviews)

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.

Parameters:
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, under pageviewservice-supported-metrics / <module name>

pageviews
Plain pageviews.
One of the following values: pageviews
Default: pageviews
pvipdays

The number of days to show.

The value must be between 1 and 60.
Type: integer
Default: 60
pvipcontinue

When more results are available, use this to continue.

Example:
Show pageview statistics for the main page.
api.php?action=query&titles=Main_Page&prop=pageviews [open in sandbox]

meta=siteviews (pvis)

(main | query | siteviews)

Shows sitewide pageview data (daily pageview totals for each of the last pvisdays days).

The result format is date (Ymd) => count.

Parameters:
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, under pageviewservice-supported-metrics / <module name>

pageviews
Plain pageviews.
uniques
Unique visitors.
One of the following values: pageviews, uniques
Default: pageviews
pvisdays

The number of days to show.

The value must be between 1 and 60.
Type: integer
Default: 60

list=mostviewed (pvim)

(main | query | mostviewed)
  • 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).

Parameters:
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, under pageviewservice-supported-metrics / <module name>

pageviews
Plain pageviews.
One of the following values: pageviews
Default: pageviews
pvimlimit

The number of pages to return.

No more than 500 (5,000 for bots) allowed.
Type: integer or max
Default: 10
pvimoffset

When more results are available, use this to continue.

Type: integer
Default: 0