Extension:PageViewInfo

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
PageViewInfo

Release status:Extension status beta

ImplementationTemplate:Extension#type MyWiki
DescriptionTemplate:Extension#description Provides fancy looking graphs of Wikimedia page view data
Author(s)Template:Extension#username Kunal Mehta (Legoktmtalk)
Compatibility policyCompatibility#mediawiki_extensions release branches
MediaWikiTemplate:Extension#mediawiki 1.27+
PHPTemplate:Extension#php 5.5+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download
ExampleTemplate:Extension#example bf-wmpageview.wmflabs.org
ParametersTemplate:Extension#parameters
  • $PageViewInfoWikimediaEndpoint
  • $PageViewInfoWikimediaDomain
  • $PageViewInfoWikimediaRequestLimit
  • $PageViewApiMaxDays
Services definedTemplate:Extension#service
MediaWiki\Extensions\PageViewInfo\PageViewService
Hooks usedTemplate:Extension#hook
InfoActionManual:Hooks/InfoAction
ApiQuery::moduleManagerManual:Hooks/ApiQuery::moduleManager
APIQuerySiteInfoGeneralInfoManual:Hooks/APIQuerySiteInfoGeneralInfo

Translate the PageViewInfo extension if it is available at translatewiki.net

Check usage and version matrix.
Vagrant roleMediaWiki-Vagrant#Using roles pageviewinfo

IssuesPhabricator

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]

Manual installation

  • Requires GraphExtension: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' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

API[edit]

prop=pageviews (pvip)

(main | query | pageviews)
  • This module requires read rights.
  • Source: PageViewInfo
  • License: GPL-3.0+

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)
  • This module requires read rights.
  • Source: PageViewInfo
  • License: GPL-3.0+

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
Examples:
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)

(main | query | mostviewed)
  • This module requires read rights.
  • This module can be used as a generator.
  • Source: PageViewInfo
  • License: GPL-3.0+

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
Examples:
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]