Analytics/AQS/Wikistats 2

From Wikitech
< Analytics‎ | AQS
Jump to navigation Jump to search

This page documents how to access Wikistats 2 data through the Analytics Query Service API. Available metrics revolve around edits, edited-pages, editors and newly-registered-users.

The Analytics Team has taken a lot of ideas from Erik Zachte work, and we are immensely grateful for all the work Erik has put into gathering, consolidating and maintaining stats over wikimedia project for many years. For more on the differences between the two datasets, see the Analytics/AQS/Wikistats 2/Data Quality page (disclaimer: they are small!).

Quick Start

Technical Documentation: https://wikimedia.org/api/rest_v1/?doc (includes interactive examples).

Edits and changed-bytes

Warning Caution: These metrics measure edition activity, therefore they include edits on redirects. Also, these metrics can be queried for project-families as in all-wikipedia-projects for instance.

Get the monthly number of edits for en.wikipedia.org between January and October 2017, made by registered users on articles (pages in content namespace):

GET https://wikimedia.org/api/rest_v1/metrics/edits/aggregate/en.wikipedia/user/content/monthly/20170101/20171001

Get the daily number of edits for all wikitionary.org projects for August 2018, made by registered users on articles (pages in content namespace):

GET https://wikimedia.org/api/rest_v1/metrics/edits/aggregate/all-wiktionary-projects/user/content/daily/20180801/20180901

Get the daily bytes-difference (sum of the number of bytes added or removed by edits) for wikidata.org for September 2017, made by all editor-types on all page-types:

GET https://wikimedia.org/api/rest_v1/metrics/bytes-difference/net/aggregate/wikidata/all-editor-types/all-page-types/daily/20170901/20171001

Get the monthly absolute bytes-difference (sum of the absolute value of bytes changed by edits) for fr.wikisource.org for year 2016, made by bots (users belonging to bot group) on articles (pages in content namespace):

GET https://wikimedia.org/api/rest_v1/metrics/bytes-difference/absolute/aggregate/fr.wikisource.org/group-bot/content/monthly/20160101/20170101

Get the daily number of edits for page Barack Obama on en.wikipedia.org between January 2017 and February 2017, made by registered users:

GET https://wikimedia.org/api/rest_v1/metrics/edits/per-page/en.wikipedia/Barack+Obama/user/daily/20170101/20170201

Edited Pages

Warning Caution: This metric measures content, therefore it doesn't includes redirect pages.

Pages Created

Get the daily number of new edited-pages (also named pages created) for es.wikipedia.org between the 10th and the 30th of January 2015, made by all editor-types on non-content pages:

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/new/es.wikipedia/all-editor-types/non-content/daily/20150110/20150130

Total article count

This metric is easily derived from the previous Pages Created one, taking it's cumulative value.

Edited Pages

Get the monthly number of edited-pages for ja.wikipedia.org for 2017, made by registered users on articles (pages belonging to content namespaces), for pages all page-activity-levels (any number of edits per page):

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/aggregate/ja.wikipedia/anonymous/all-page-types/all-activity-levels/monthly/20150101/20160101

Get the monthly number of edited-pages for commons.wikimedia.org for 2015, made by anonymous users on all page-types, for pages having been edited 1 to 4 times:

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/aggregate/commons.wikimedia/anonymous/all-page-types/1..4-edits/monthly/20150101/20160101

Top Edited Pages

Get the monthly top-100 most edited pages ru.wikipedia.org in January 2017, made by all editor-types on articles (pages belonging to content namespaces):

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/top-by-edits/ru.wikipedia/all-editor-types/content/2017/01/all-days

Get the monthly top-100 pages that have been added most bytes for zh.wikipedia.org in September 2017, changed by registered editors, all page-types:

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/top-by-net-bytes-difference/zu.wikipedia/user/all-page-types/2017/09/all-days

Get the daily top-100 pages having been mostly changed in bytes for it.wikipedia.org the 1st of August 2017, changed by anonymous editors, all page-types:

GET https://wikimedia.org/api/rest_v1/metrics/edited-pages/top-by-absolute-bytes-difference/it.wikipedia/anonymous/all-page-types/2017/08/01

Editors

Warning Caution: This metric measures editors' activity, therefore it includes edits on redirects.

Get the monthly number of editors for pl.wiktionary.org for January to August 2017, being any editor-type, and having edited any article-type between 5 and 24 times:

GET https://wikimedia.org/api/rest_v1/metrics/editors/aggregate/pl.wiktionary/all-editor-types/all-page-types/5..24-edits/monthly/20170101/20170901

Get the daily number of editors for hi.wikipedia.org for September 2017, being registered users, on articles (pages belonging to content namespaces), any activity-level:

GET https://wikimedia.org/api/rest_v1/metrics/editors/aggregate/hi.wikipedia/user/content/all-activity-levels/daily/20170901/20171001

Top Editors

Warning Caution: anonymous editors IPs are replaced by Anonymous Editor in the next requests.

Get the monthly top-100 editors by edits number for en.wiktionary.org in January 2017, being bots (belonging to the bot group) having edited any page-types:

GET https://wikimedia.org/api/rest_v1/metrics/editors/top-by-edits/en.wiktionary/group-bot/all-page-types/2017/01/all-days

Get the daily top-100 editors having added most bytes for de.wikivoyage.org the 2nd of May 2016, being registered editors, all page-types:

GET https://wikimedia.org/api/rest_v1/metrics/editors/top-by-net-bytes-difference/de.wikivoyage/user/all-page-types/2016/05/02

Get the monthly top-100 editors having changed most bytes forwikidata.org in September 2017, being all-editor-types, all page-types:

GET https://wikimedia.org/api/rest_v1/metrics/editors/top-by-absolute-bytes-difference/wikidata/all-editor-types/all-page-types/2017/09/all-days

Newly Registered Users

Get the daily number of newly registered users for de.wikipedia.org for January 2017:

GET https://wikimedia.org/api/rest_v1/metrics/registered-users/new/de.wikipedia/daily/20170101/20170201

More Reading

Metrics Definition

Analytics/AQS/Wikistats 2/Metrics Definition

Data Quality

Analytics/AQS/Wikistats 2/Data Quality

Underlying Dataset

Analytics/Data_Lake/Edits/Mediawiki_history (not public yet, includes the most detailed version of history we have been able to rebuild so far)

Data Processing Overview

Analytics/Systems/Data_Lake/Edits/Pipeline

The Analytics Query Service API (AQS)

Analytics/AQS