Commons:Digital Public Library of America/Analytics

This project page in other languages:
English
Example usage of {{Views from category}}, as seen on Category:Media contributed by the Digital Public Library of America.

In order to improve access to page view data for Wikimedia Commons categories, especially for contribution categories for GLAMs and other partnerships, DPLA maintains a tool to display this data on the category wiki page itself. This works by adding the {{Views from category}} template to the category page, which is then updated on a monthly basis by DPLA bot, using data extracted from the Commons Impact Metrics endpoint.

There are currently 602 categories utilizing this tool.

Purpose

When added, the template generates a colored banner box on the category page. In order not to take up all available screen real estate, the box is collapsed by default, but may be expanded to view all the data.

When expanded, the displayed data includes:

  • the number of files in the category
  • the number of total page views recorded
  • the monthly breakdown of page views

There is also a note at the bottom of each page noting the last time the data was updated, with a link to the Commons Impact Metrics API query where live data can be found.

Usage notes

{{Views from category}} as it will appear while collapsed on the category page.

In order to display this data, simply edit the category page you would like to use, and place {{views from category}} on the page. Since this takes up the full width of the page, it is best to place it above an infoboxes or other page content it might conflict with.

Alternatively, you could wrap the template in {{right|{{views from category}}}} to display the table in a floating box on the right.

Note, data will not be immediately visible. Two steps have to happen before data can appear. First, the category must be added to the Commons Impact Metrics allow-list. We will submit requests for any categories we encounter that are not yet on the allow-list, but it may take up to 2 months for data to generate (i.e., until we detect a missing category on our next run, and then until WMF processes our request, and then for the next full month of data to complete). To speed up the process, you can follow the WMF's process for requesting a new category to be added yourself. Finally, even when a category already has data in the Commons Impact Metrics endpoint, we typically only run a check once monthly, so the data will not populate in the Commons category until the next pass.

Data

Data is derived from the Commons Impact Metrics' /pageviews-per-category-monthly/ endpoint. This measures page views and not media requests, meaning the numbers being reported represent how many times the Wikimedia content pages showing files in this Commons category were viewed—which does not count certain other usages, such as views on the Commons page itself, or views in Google Image searches, thumbnails generated for category or search result views, etc. We use the deep parameter, which means all files at all levels of the category's subcategories will also be counted.

Data is only available from the first full month the category is added to the Commons Impact Metrics allow-list, or starting in November 2023 for categories that were added at the start of the Commons Impact Metrics' original release. For more information about this data and its limitations, please see the "Properties and caveats" section of the documentation.

The DPLA bot code scans categories using {{views from category}} on a monthly basis and saves data from the endpoint to a tabular data page on Wikimedia Commons. This page contains the actual data, which is then called using {{Tabular query}} (relying on Module:Tabular data) to be displayed on the category page. The layout of the data displayed is specified by a separate template: {{Views from category/table}}. You can find all the saved datasets here: Special:Prefixindex/Data:Views/.

Since it is saved as tabular data to Commons, the data from these datasets could theoretically be called from any other pages or reused in other templates, including on other wikis. Using the dataset, we dynamically generate an area chart using the new Chart extension. The configuration for these charts is saved in the data namespace as well, under the same naming convention as the tabular data for each category (but with the .chart extension).

Feedback/support

Commons Impact Metrics is public and requires no API key, so the script that runs this project can be easily run by anyone with Pywikibot (or in PAWS with almost no setup). The code is available at /Code.

This tool is currently maintained by Dominic, at the Digital Public Library of America, and developed with support from the Sloan Foundation. Please feel free to leave any comments on Dominic's talk page, or send to dominic@dp.la.

Category:Pageviews Analysis Category:Commons statistics - Categorization Category:Commons tools
Category:Commons statistics - Categorization Category:Commons tools Category:Pageviews Analysis