Page MenuHomePhabricator

Way to access pageview data via wikitext
Open, Needs TriagePublicFeature

Description

Say I wanted to get the total number of page views during last month (or whatever period) for the current page or some other page. For example for displaying the number in the infobox of said page, or for creating a table of pages and sort them by page views.

Currently there's no way to do so in Wikimedia wikis, short of unwise hacks via the Graph extension. A handy {{PAGEVIEWS}} magic word or parser function would be welcome.

Event Timeline

@Sophivorus: Hi, please use the feature request form (linked from the top of the task creation page) to create feature requests, and fill out the fields. Thanks.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Dec 25 2021, 5:44 PM

PageViewInfo caches the last 30 days (or maybe last 2*30, I don't remember the exact logic) so an arbitrary time range is unlikely to be supported. For the cached period, it should be doable, but the parser cache expiry would have to be reduced to 24 hours, presumably, which is a concern if such a magic word gets widely used.

The main use case I have in mind for this feature is to build tables of articles sorted by page views so as to prioritize my work and also help others prioritize theirs. (I've been using https://pageviews.toolforge.org/ so far but having the tables on-wiki would make all the difference for new users).

Therefore, it doesn't really matter if we can only get the page views for the last 30 or 60 days, or if the number gets updated every 24 hours. :-) On the other hand, what does matter is being able to get the page views for any page, not just the current page.

Thanks!

That seems doable in theory (unless it runs into some sort of scaling problem if a lot of pages end up using it). Using a bot might be much simpler though.

Hm, yes a bot may be simpler for this particular use case, but looking
beyond, I think a parser function to get page views would open up
possibilities for other developers and template editors across projects. I
think the movement could benefit a lot from more and better tools for
prioritizing work and motivating editors, and a simple way to get page
views to build templates, modules, tables and other tools from them could
go a long way to facilitate prioritization and motivation. That being said,
if you decide not to implement this, no problem I can do the bot for my use
case. :-) Cheers !