Project page-view counts

wx_project_views(
  project,
  access_method = c("all", "desktop", "mobile web", "mobile app"),
  agent_type = c("all", "user", "bot", "spider", "automated"),
  granularity = c("daily", "monthly", "hourly"),
  start_date = "20191231",
  end_date = "20200101"
)

Arguments

project

The name of any Wikimedia project formatted like {language code}.{project name}, for example en.wikipedia. You may pass en.wikipedia.org and the .org will be stripped off. For projects like Wikimedia Commons (without language codes), use commons.wikimedia. For projects like www.mediawiki.org, you can use that full string, or just use mediawiki or mediawiki.org.

access_method

If you want to filter by access method, use one of: "desktop", "mobile app", or "mobile web". If you are interested in pageviews regardless of access method, use "all" (default).

agent_type

If you want to filter by agent type, use "user", "bot"/"spider", or "automated" (refer to wikitech:Analytics/Data Lake/Traffic/BotDetection). If you are interested in pageviews regardless of agent type, use "all" (default).

granularity

The time unit for the response data. As of today, supported values are daily (default), monthly, and hourly. In case of hourly granularity, for simplicity, the function retrieves data from the very start of start_date (hour 00) to the very end of end_date (hour 23).

start_date

The date of the first day to include, in YYYYMMDD format. Can also be a Date or a POSIXt object, which will be auto-formatted.

end_date

The date of the last day to include, in YYYYMMDD format. Can also be a Date or a POSIXt object, which will be auto-formatted.

Value

A tibble data frame with the following columns:

project

project

date

Date if daily or monthly granularity, POSIXct for hourly; all times are in UTC

views

total number of page-views for the project

License

Data retrieved from the API endpoint is available under the CC0 1.0 license.

See also

Examples

# block from 2017-04-29 to 2020-01-15 wx_project_views( "tr.wikipedia", # Turkish granularity = "monthly", start_date = "20191001", end_date = "20200229" )
#> # A tibble: 5 x 3 #> project date views #> <chr> <date> <int> #> 1 tr.wikipedia 2019-10-01 74376756 #> 2 tr.wikipedia 2019-11-01 69159777 #> 3 tr.wikipedia 2019-12-01 74319107 #> 4 tr.wikipedia 2020-01-01 113732170 #> 5 tr.wikipedia 2020-02-01 127052947