# Wikipedia Pageviews: Topic Trends, Top Articles by Country (`yadroo/wikipedia-pageviews-trends`) Actor

Reader interest from the official Wikimedia pageviews API: one row per article and date with exact views, share of the wiki's traffic and change against the previous bucket. Also the most-read articles of a language edition, the top articles opened in a country, and which countries read a wiki.

- **URL**: https://apify.com/yadroo/wikipedia-pageviews-trends.md
- **Developed by:** [Samat Makatov](https://apify.com/yadroo) (community)
- **Categories:** SEO tools, News, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 pageview rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Wikipedia Pageviews: Topic Trends, Top Articles by Country

Reader interest from the official Wikimedia pageviews API: one row per article and date with exact views, share of the wiki's traffic and change against the previous bucket. Also the most-read articles of a language edition, the top articles opened in a country, and which countries read a wiki.

Four questions, one actor: how did attention to a topic move, what did people read yesterday, what do readers in one country open, and which countries are behind a wiki's traffic. Every number comes from the Wikimedia Foundation's public analytics API — no key, no proxy, no browser — and lands as dataset rows with exact counts, the article's share of everything the wiki served, and the day-over-day change. These are **reads of encyclopaedia pages**, in absolute and bot-filtered counts, not a normalised search-interest index: a different signal, with per-language editions, per-country rankings and a device split that an index cannot give.

> **Need it tailored to your workflow?** Missing a field, a filter, another source or a different output format? [Open an issue](https://apify.com/yadroo/wikipedia-pageviews-trends/issues) and describe what you need — we read every request and adapt the actor.

### Use cases

- **Content and SEO planning**: pull a 30- or 365-day curve for the topics you write about, compare them on `shareOfProjectPct` instead of raw counts, and see which ones are growing rather than just large.
- **Newsrooms and trend dashboards**: the most-read articles of the last finished days, with front pages and search pages filtered out, so the list is about topics and not site furniture.
- **Market entry and localisation**: what readers *inside* a country open (`topByCountry`), across every Wikimedia project at once — a signal a single language edition cannot give you.
- **Audience sizing**: which countries are behind one wiki's monthly traffic (`countryBreakdown`), to judge where an edition's readers actually are.
- **Product analytics**: run the same titles twice with `access: mobile-web` and `access: desktop` to get the device split of a topic; news-driven topics lean mobile, reference topics much less.
- **Daily schedules**: switch `onlyNew` on and a scheduled task appends yesterday's bucket per run instead of resending the whole history.
- **Agents and LLM pipelines**: an MCP or API call returns a number, not a chart; narrow the columns with `fields` to keep the context small.

### Input

Nothing is required. An empty input reads the two prefilled titles on `en.wikipedia` over the last 30 days.

| Field | Type | Default | Allowed values / notes |
|---|---|---|---|
| `mode` | string (enum) | `articleTrends` | `articleTrends`, `topArticles`, `topByCountry`, `countryBreakdown` — see [Modes](#modes). Off-list values are refused by the platform before the run starts. |
| `articles` | string\[] | empty | Page titles, one per line, up to 50. Spaces and underscores are read the same; a pasted article link is reduced to its title. On Wikipedia editions the first letter is capitalised as the wiki does (`bitcoin` is read as `Bitcoin`, the status says so); other characters and other projects (Wiktionary) are matched letter by letter. Article-trends mode only; each title costs one request. |
| `project` | string | empty → `en.wikipedia` | A wiki id such as `en.wikipedia`, `ru.wikipedia`, `commons.wikimedia`, `www.wikidata`. Case, spaces, a trailing `.org`, a pasted wiki address, the bare language code (`ru`) and the English language name (`russian`) are accepted; any other spelling is refused with the closest known ones. See [Wikis](#wikis). |
| `countries` | string\[] | empty | ISO 3166-1 alpha-2 codes, up to 10. Lower case and the English names of about a hundred large countries are accepted; any other value is refused with the closest codes. Top-articles-in-a-country mode only. See [Countries](#countries). |
| `granularity` | string (enum) | `daily` | `daily` or `monthly`. A month is always read whole, and a month that is not over yet is left out. Two modes have one resolution only (see [Modes](#modes)). Strict enum. |
| `sinceDays` | integer | `30` | 1–3650. Rolling window back from the newest published day (UTC), used when a date is missing. |
| `startDate` | string | empty | `YYYY-MM-DD`, or `YYYY-MM` for the first day of that month (UTC). |
| `endDate` | string | empty | `YYYY-MM-DD`, or `YYYY-MM` for the last day of that month (UTC), inclusive. A date past the newest published day is pulled back to it. |
| `access` | string (enum) | `all-access` | `all-access`, `desktop`, `mobile-web`, `mobile-app`. Strict enum. |
| `agent` | string (enum) | `user` | `user`, `all-agents`, `spider`, `automated`. Article trends only — the ranking endpoints have no agent filter. Strict enum. |
| `excludeNonArticles` | boolean | `true` | Drop front pages, search pages and namespace pages from the ranking modes. See [The non-article filter](#the-non-article-filter). |
| `includeShare` | boolean | `true` | Add `projectViews` and `shareOfProjectPct` to article rows. One extra request per run, not per article. |
| `onlyNew` | boolean | `false` | Write only buckets this actor or task has not returned before. |
| `maxItems` | integer | `50` | 1–2000. Hard cap on rows, and so on cost. Spread over the titles, countries and buckets you asked for, newest bucket first. |
| `fields` | string\[] | all | Keep only these columns, **in this order**. `mode`, `project`, `article`, `date`, `views`, `found`, `url` and `fetchedAt` are always kept (first, unless you list them — a column you name stays where you put it). |

Two kinds of field, two behaviours:

- **Closed dictionaries** (`mode`, `granularity`, `access`, `agent`) are enums. Apify refuses an off-list value before the run even starts, with the allowed values in the error message — so there is no typo correction for them, and none is needed.
- **List-backed free text** (`project`, `countries`) forgives case, spaces, diacritics, underscores and the aliases listed below. Anything else is refused with a "did you mean …" naming the closest values, because a near miss is another entity as often as a typo. A value read through an alias is named in the run status.

All dates are UTC. A finished day is published about one day later, so the newest daily bucket is normally yesterday (UTC); early in the UTC day it may be the day before, and the status names the day the range really ended on.

### Reference

#### Modes

| Mode | What one row is | Resolution | Uses |
|---|---|---|---|
| `articleTrends` | one article and one bucket, with exact views, share of the wiki and change | `daily` or `monthly` | `articles`, `project`, `agent`, `access`, `includeShare` |
| `topArticles` | one ranked article of one wiki in one bucket | `daily` or `monthly` | `project`, `access`, `excludeNonArticles` |
| `topByCountry` | one ranked article readers in one country opened on one day, across all Wikimedia projects | `daily` only (the API has no monthly form) | `countries`, `access`, `excludeNonArticles` |
| `countryBreakdown` | one country behind one wiki's traffic in one month | `monthly` only | `project`, `access` |

When a mode is given the resolution it does not have, the run uses the one it does have and says so in the status.

#### Traffic filters

| `access` | Counts |
|---|---|
| `all-access` | every channel together |
| `desktop` | the desktop site |
| `mobile-web` | the mobile site |
| `mobile-app` | the Wikipedia apps |

| `agent` | Counts |
|---|---|
| `user` | what Wikimedia classified as human readers — the comparable series |
| `all-agents` | everything counted, humans and machines |
| `spider` | known crawlers only |
| `automated` | known automated clients only |

#### Wikis

A wiki id is `<code>.<project>`. Frequent ones: `en.wikipedia`, `es.wikipedia`, `de.wikipedia`, `fr.wikipedia`, `ru.wikipedia`, `ja.wikipedia`, `zh.wikipedia`, `pt.wikipedia`, `it.wikipedia`, `fa.wikipedia`, `ar.wikipedia`, `pl.wikipedia`, `uk.wikipedia`, `tr.wikipedia`, `id.wikipedia`, `nl.wikipedia`, `hi.wikipedia`, `ko.wikipedia`, `vi.wikipedia`, `kk.wikipedia`, `uz.wikipedia`, `ky.wikipedia`, `tg.wikipedia`, `az.wikipedia`, `hy.wikipedia`, `ka.wikipedia`, `he.wikipedia`, `sv.wikipedia`, `no.wikipedia`, `da.wikipedia`, `fi.wikipedia`, `cs.wikipedia`, `sk.wikipedia`, `hu.wikipedia`, `ro.wikipedia`, `bg.wikipedia`, `el.wikipedia`, `sr.wikipedia`, `hr.wikipedia`, `ca.wikipedia`, `th.wikipedia`, `bn.wikipedia`, `ta.wikipedia`, `ms.wikipedia`, `sw.wikipedia`, `simple.wikipedia`.

Sister projects: `commons.wikimedia` (media), `www.wikidata`, `meta.wikimedia`, `species.wikimedia`, `mediawiki`, and the `<code>.wiktionary` / `.wikisource` / `.wikiquote` / `.wikibooks` / `.wikinews` / `.wikiversity` / `.wikivoyage` families.

Accepted spellings for the ones above: the id itself, the id with `.org`, a pasted wiki address, the bare language code (`ru`, `de`, `kk`), the English language name (`russian`, `german`, `kazakh`), and `commons`, `wikidata`, `meta`, `species`. Any other wiki the API serves works too as long as it has the `<code>.<project>` shape — `ast.wikipedia` and `kk.wikinews` are passed on as typed. A spelling that is not a wiki id at all stops the run with the closest known ones named.

#### Countries

Every ISO 3166-1 alpha-2 code is accepted, in any case: `US`, `GB`, `DE`, `FR`, `ES`, `IT`, `NL`, `PL`, `RU`, `UA`, `KZ`, `UZ`, `TR`, `IL`, `AE`, `SA`, `EG`, `NG`, `ZA`, `KE`, `IN`, `PK`, `BD`, `ID`, `TH`, `VN`, `PH`, `MY`, `SG`, `JP`, `KR`, `CN`, `HK`, `TW`, `AU`, `NZ`, `CA`, `MX`, `BR`, `AR`, `CL`, `CO`, `PE` and the rest of the list.

The English names of about a hundred large countries work as aliases — `United States` (also `USA`, `America`), `United Kingdom` (also `UK`, `Britain`, `England`), `Germany`, `Czechia`, `South Korea`, `Ivory Coast`, `United Arab Emirates` and so on. Anything else is refused with the closest codes named, so a wrong code never silently returns another country's data.

#### The non-article filter

With `excludeNonArticles` on (the default), the ranking modes drop:

- a wiki's front page in any language — `Main_Page`, `Заглавная_страница`, `Hauptseite`, `メインページ`, `Pagina_principale`, `Hoofdpagina`, `대문`, `首页` and the rest;
- anything in a namespace, which MediaWiki writes as one word, a colon and the page name with no space after the colon: `Special:Search`, `Служебная:Поиск`, `Spezial:Suche`, `특수:검색`, `خاص:بحث`, `Wikipedia:Featured_pictures`, `Portal:Current_events`, `Category:…`, `File:…`, `Talk:…`.

Article titles that merely contain a colon keep the space after it (`Star Wars: Episode IV`) and are not dropped. Ranks stay as the API numbered them, so a gap in `rank` shows where something was removed. Switch the filter off to get every entry exactly as received.

### Examples

**Topic interest over time, for content and SEO planning**

```json
{ "mode": "articleTrends", "articles": ["Artificial intelligence", "ChatGPT", "Large language model"], "project": "en.wikipedia", "granularity": "daily", "sinceDays": 30, "includeShare": true, "maxItems": 45 }
```

**What the world read yesterday**

```json
{ "mode": "topArticles", "project": "en.wikipedia", "granularity": "daily", "sinceDays": 3, "excludeNonArticles": true, "maxItems": 50 }
```

**Top articles read in the United States and Germany**

```json
{ "mode": "topByCountry", "countries": ["US", "DE"], "granularity": "daily", "sinceDays": 4, "excludeNonArticles": true, "maxItems": 40 }
```

**Which countries read English Wikipedia**

```json
{ "mode": "countryBreakdown", "project": "en.wikipedia", "startDate": "2026-08", "endDate": "2026-09", "maxItems": 40 }
```

**Most-read Russian Wikipedia articles of a month**

```json
{ "mode": "topArticles", "project": "ru.wikipedia", "granularity": "monthly", "startDate": "2026-10", "endDate": "2026-10", "maxItems": 30 }
```

**Mobile-only interest in a few topics, with narrowed columns**

```json
{ "mode": "articleTrends", "articles": ["Bitcoin", "Ethereum", "Dogecoin"], "project": "en.wikipedia", "access": "mobile-web", "sinceDays": 21, "fields": ["article", "date", "views", "shareOfProjectPct"], "maxItems": 45 }
```

**Kazakhstan topics on Russian Wikipedia, as a daily schedule**

```json
{ "mode": "articleTrends", "articles": ["Казахстан", "Алма-Ата", "Астана"], "project": "ru.wikipedia", "sinceDays": 30, "onlyNew": true, "maxItems": 45 }
```

### Output

One real row from a cloud run (`articleTrends`, `en.wikipedia`, 30-day window):

```json
{
  "mode": "articleTrends",
  "project": "en.wikipedia",
  "article": "Artificial_intelligence",
  "articleTitle": "Artificial intelligence",
  "date": "2026-11-03",
  "granularity": "daily",
  "access": "all-access",
  "agent": "user",
  "views": 15121,
  "viewsExact": true,
  "viewsRange": null,
  "projectViews": 184958431,
  "shareOfProjectPct": 0.008175,
  "changePct": -0.38,
  "rank": null,
  "country": null,
  "found": true,
  "url": "https://en.wikipedia.org/wiki/Artificial_intelligence",
  "fetchedAt": "2026-11-04T21:43:25.000Z"
}
```

| Field | Type | When it is filled | View |
|---|---|---|---|
| `mode` | string | always — which question the row answers | Rankings |
| `project` | string | null | the wiki the count belongs to; empty on a marker row for a country with no data | all |
| `article` | string | null | page title with underscores, as the API spells it; empty on country-breakdown rows | Article trends, Rankings |
| `articleTitle` | string | null | the same title with spaces | Article trends, Rankings |
| `date` | string | null | `YYYY-MM-DD` for a day bucket, `YYYY-MM` for a month bucket (UTC) | all |
| `granularity` | string | `daily` or `monthly` | Article trends |
| `access` | string | the device channel asked for | all |
| `agent` | string | null | article trends only; the ranking endpoints have no agent filter | Article trends |
| `views` | integer | null | the comparable number — exact for article and wiki rankings, a rounded ceiling for country data | all |
| `viewsExact` | boolean | null | `true` = a measured count; `false` = the privacy ceiling the API publishes | Rankings, Countries |
| `viewsRange` | string | null | the published bucket string of a country-breakdown row, e.g. `100000000-999999999` | Countries |
| `projectViews` | integer | null | everything the wiki served in the same bucket, when the share is on | Article trends |
| `shareOfProjectPct` | number | null | `views / projectViews × 100`, six decimals | Article trends |
| `changePct` | number | null | `(views − previous) / previous × 100`, two decimals; empty on the oldest bucket and in the ranking modes | Article trends |
| `rank` | integer | null | rank inside the bucket, as the API numbered it before the non-article filter | Rankings, Countries |
| `country` | string | null | the readers' country (top-by-country) or the reading country (country breakdown) | Rankings, Countries |
| `found` | boolean | `false` on a marker row for a title the wiki never served or a country the API withholds | Countries |
| `url` | string | null | link to the page, or to the wiki on a country row | all |
| `fetchedAt` | string | when the run read the API, ISO 8601 UTC | all |

Dataset views: **Article trends**, **Top articles**, **Countries of a wiki**.

A ranked country row looks like this (`countryBreakdown`, `en.wikipedia`, September 2026):

```json
{ "mode": "countryBreakdown", "project": "en.wikipedia", "article": null, "articleTitle": null, "date": "2026-09",
  "granularity": "monthly", "access": "all-access", "agent": null, "views": 2663042000, "viewsExact": false,
  "viewsRange": "1000000000-9999999999", "projectViews": null, "shareOfProjectPct": null, "changePct": null,
  "rank": 1, "country": "US", "found": true, "url": "https://en.wikipedia.org/",
  "fetchedAt": "2026-11-04T21:43:37.403Z" }
```

### Use it from code / agents

```bash
curl -X POST "https://api.apify.com/v2/acts/yadroo~wikipedia-pageviews-trends/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"articleTrends","articles":["Artificial intelligence"],"project":"en.wikipedia","sinceDays":14,"maxItems":20}'
```

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('yadroo/wikipedia-pageviews-trends').call({
  mode: 'topArticles', project: 'en.wikipedia', sinceDays: 1, maxItems: 25,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

```python
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("yadroo/wikipedia-pageviews-trends").call(run_input={
    "mode": "topByCountry", "countries": ["US", "DE"], "sinceDays": 2, "maxItems": 20,
})
items = client.dataset(run["defaultDatasetId"]).list_items().items
```

MCP: add `https://mcp.apify.com` to Claude / Cursor / any MCP client and call the `yadroo/wikipedia-pageviews-trends` tool with the same JSON input. For agents, `fields` keeps the answer small: `{"fields": ["article", "date", "views"]}` returns the always-kept columns plus those three, in that order. The column names above are stable; new columns may be added at the end.

### Pricing

Pay per event: **$0.001 per run start + $0.001 per row** written to the dataset (FREE tier).

| Tier | Row | Run start |
|---|---|---|
| FREE | $0.001 | $0.001 |
| BRONZE | $0.0009 | $0.001 |
| SILVER | $0.0008 | $0.001 |
| GOLD and above | $0.0007 | $0.001 |

Every run is charged the start event, also a run that returns nothing. Every row written to the dataset is charged, and that includes a `found: false` marker row for a title the wiki never served or a country the API withholds — the row is the answer to that part of your input.

Worked examples at FREE prices:

- a 30-day daily curve of 3 topics, 90 rows: $0.001 + 90 × $0.001 = **$0.091**;
- the top 50 articles of yesterday: $0.001 + 50 × $0.001 = **$0.051**;
- 12 months of country breakdown at 40 countries a month, 480 rows: $0.001 + 480 × $0.001 = **$0.481**;
- the default input (2 titles, 30 days, cap 50): $0.001 + 50 × $0.001 = **$0.051**.

`maxItems` is the hard cap on rows and therefore on cost. The run also respects Apify's **Maximum cost per run**: when that budget is reached the run stops, keeps every row you paid for, and ends with "Stopped at your spending limit: N rows delivered". Because buckets are read newest first, a run that stops early still holds the freshest data.

### Limits & FAQ

**Speed.** The actor sends at most one request per second to `wikimedia.org` on a single token bucket, retries included: the Foundation's access policy publishes no numeric rate limit, so this is the polite pace. Measured in the Apify cloud on **2026-11-04**, including a run at the largest batch this README describes (50 titles over 30 days, 51 requests): a steady **52–60 requests a minute**, with no HTTP 429 and no `Retry-After` in any run. One request returns the whole date range of one title (up to 365 rows) or up to 1,000 ranks of one bucket, so rows per minute depend on the shape of the job: those 50 titles gave 100 rows in 52 s, three article curves gave 45 rows in 5.6 s with 4 requests, a two-month country breakdown gave 40 rows in 2.6 s with 2 requests, and 36 ranked rows across 2 countries and 4 days took 8 requests and 8.6 s. The limit of the pace, not of the source, is what you plan with: **about 50 requests a minute**, and any number of rows those requests happen to carry. At about 50 requests a minute a 900-second run covers about 700 requests: any 50 titles, every monthly job, or about 700 day buckets in the ranking modes. A longer daily ranking range (for example `topArticles` daily over 3,650 days, one request per day) stops before the timeout, keeps every row it read and says so ("Stopped before the run timeout: N rows saved" — checked with a 365-bucket job and a 60-second timeout, which saved 77 rows from 42 requests and ended SUCCEEDED).

**Data coverage.** The endpoints serve data from **1 July 2015** on; a range reaching further back simply returns fewer buckets. A finished UTC day is published about **one day later**, so the newest daily bucket is normally yesterday (UTC); early in the UTC day it may not be published yet, then the newest row is the day before. An `endDate` past the newest published day is pulled back and the status names the day the range really ended on.

**Months are read whole.** A monthly range that starts or ends mid-month is widened to the first and last day of those months, and a month that is not over yet is left out — a partial month reported as a full one is the easiest way to draw a wrong conclusion.

**Country data is deliberately coarse.** Wikimedia rounds it to protect readers: `views` is an upper bound (`viewsExact: false`) and `countryBreakdown` also gives the published range in `viewsRange`. The API returns nothing at all for countries below roughly 100 views in the period or on the Foundation's protection list — `KZ` answered nothing on 2026-11-04, for example. Such a country comes back as one `found: false` row rather than as a silently shorter list.

**Zero and missing buckets.** Small wikis have days with `views: 0`, and those rows are kept. A day the API has no data for at all is simply absent, and the run status counts how many buckets were empty.

**Redirects count separately.** On Wikipedia editions the first letter is capitalised as the wiki itself does (`bitcoin` is read as `Bitcoin`, and the status says so); every other character, and every other project such as Wiktionary, is matched letter by letter, so `Алматы` (a redirect) and `Алма-Ата` (the article) have separate counts, and a redirect usually has far fewer views. Use the title the wiki actually serves.

**No agent filter on rankings.** `/top`, `/top-per-country` and `/top-by-country` have no `agent` parameter, so those counts include crawlers and automated clients. `agent` applies to article trends only and is empty in ranking rows.

**Pageviews are not a search index.** They count reads of encyclopaedia pages in absolute, bot-filterable numbers. They move with news and seasons, they are not normalised, and they say nothing about what people typed into a search engine.

**Rate limiting and errors.** On HTTP 429 or 5xx the actor waits — honouring `Retry-After` — and retries within a bounded budget; a request that cannot finish before the run's deadline ends the run cleanly with the rows already saved. A title or bucket the API answers 404 for is not an error: it becomes a `found: false` row or a counted empty bucket.

**No personal data.** The source publishes counts of page views only; country numbers are privacy-bucketed at the source. There is no reader, account or session data in it to collect.

**Questions or problems:** open an issue on the Issues tab of this actor.

***

Made by **Yadroo**. Sibling actors: [wikipedia-search](https://apify.com/yadroo/wikipedia-search), [wikimedia-commons-images](https://apify.com/yadroo/wikimedia-commons-images), [google-news-search](https://apify.com/yadroo/google-news-search), [hackernews-search](https://apify.com/yadroo/hackernews-search), [openalex-works](https://apify.com/yadroo/openalex-works).

# Actor input Schema

## `mode` (type: `string`):

One run answers one question. `articleTrends`: interest in the titles you list over a date range. `topArticles`: ranks every article of one wiki per day or month in the range. `topByCountry`: ranks what readers in a country opened on a day, across all Wikimedia projects (per day only). `countryBreakdown`: ranks the countries behind one wiki's traffic (per month only). Every row names its mode in `mode`; fields that do not apply to it are left empty.

## `articles` (type: `array`):

One page title per line, as the wiki writes it: `Artificial intelligence`, `Bitcoin`, `Kazakhstan`. Spaces and underscores are the same, and a pasted article link is reduced to its title. On Wikipedia editions the first letter is capitalised as the wiki does (`bitcoin` is read as `Bitcoin`); the rest is matched letter by letter (`McDonald's`, `DNA`), and a redirect counts separately from its target. An unknown title gives one `found: false` row. One request per title. Article-trends mode only.

## `project` (type: `string`):

Which wiki the views are counted on, as `<code>.<project>`: `en.wikipedia`, `ru.wikipedia`, `kk.wikipedia`, `commons.wikimedia`, `www.wikidata`. Pick a suggestion or type any project the API serves. A trailing `.org`, a pasted wiki address, case, spaces, the bare language code and the English language name (`ru`, `russian`) are accepted; anything else stops the run with the closest ids named. Empty reads `en.wikipedia` and the status says so. Ignored by the top-by-country mode.

## `countries` (type: `array`):

One two-letter country code per line (`US`, `DE`, `GB`, `JP`, `BR`; ISO 3166-1 alpha-2). Lower case and the English names of about a hundred large countries (`United States`, `Germany`) are accepted; any other value stops the run with the closest codes named. The API withholds data for small or at-risk territories: a country with nothing in the whole range comes back as one `found: false` row. Top-by-country mode only.

## `granularity` (type: `string`):

`daily`: one bucket per calendar day (UTC), for spikes and week-day patterns. `monthly`: one bucket per calendar month, steadier for long ranges; a range starting or ending mid-month is widened to whole months and a month not over yet is left out. Two modes have one resolution only (country breakdown per month, top by country per day): this field is ignored there and the run status says so.

## `sinceDays` (type: `integer`):

Rolling window counted back from the newest finished day (UTC) when no fixed dates are given: `7` for last week, `30` for last month, `365` for a year. Made for schedules - the window moves with every run, so a task never needs editing. The API publishes a day about one day after it ends, so the newest bucket of a daily run is normally yesterday (UTC); early in the UTC day it may be the day before.

## `startDate` (type: `string`):

Fixed start of the range, in UTC. Set it together with the end date to pin a period a report refers to; on its own it is combined with the newest published day. `2026-01` is accepted as shorthand for the first day of that month.

## `endDate` (type: `string`):

Fixed end of the range, in UTC, inclusive. On its own it is combined with the rolling window above. A date after the newest published day is pulled back to it, and the run status says which day it actually ended on. `2026-01` is read as the last day of that month.

## `access` (type: `string`):

Counts views made through one channel. Running the same titles twice, once with `desktop` and once with `mobile-web`, shows how a topic is read - news-driven topics are heavily mobile, reference topics much less so. Every mode supports this filter and every row repeats the value in `access`.

## `agent` (type: `string`):

`user` leaves out traffic Wikimedia classified as crawlers or automated clients, which keeps a curve comparable over months. `all-agents` keeps everything and is higher, sometimes much higher after a bot wave. `spider` and `automated` isolate those two classes, to check whether a spike was human. The ranking modes have no such filter (their numbers include every agent): applies to article trends only, left empty in other rows.

## `excludeNonArticles` (type: `boolean`):

On (default): the ranking modes skip titles that are not articles - the wiki's own front page, the search page, and anything in a namespace such as `Special:`, `Wikipedia:`, `Portal:`, `Talk:` or their translated forms. Those entries normally hold the first ranks and crowd out the topics a ranking is wanted for. Ranks are kept as the API numbered them, so a gap in the numbers shows where something was dropped. Off: every entry is written as received.

## `includeShare` (type: `boolean`):

On (default): each article row also carries `projectViews` - everything the wiki served in that bucket - and `shareOfProjectPct`, the article's percentage of it. The share is what makes two years, two wikis or two topics comparable, because it cancels the seasonal rise and fall of Wikipedia traffic as a whole. It costs one extra request per run, not per article. Off: both columns are left empty.

## `onlyNew` (type: `boolean`):

Remember which wiki, article or country and date each row covered, and on the next run of the same actor or task write only buckets that were not written before - so a daily schedule appends yesterday instead of resending the whole history. The first run writes everything in range. Memory belongs to the actor or task, so two tasks watching two wikis never mix. A bucket the API later revises is not resent.

## `maxItems` (type: `integer`):

Hard cap on the rows this run writes, and so on what it costs. The cap is spread over the titles, countries and buckets you asked for, newest bucket first, so a capped run holds the most recent data of every entity instead of all of the first one. In the ranking modes one request returns up to 1,000 ranks of one bucket, so a cap of 50 on a single day answers with the top 50.

## `fields` (type: `array`):

Keep only the named columns, in this order - for example `article, date, views, shareOfProjectPct`. Empty = every column. `mode`, `project`, `article`, `date`, `views`, `found`, `url` and `fetchedAt` are always written; name one of them here and it moves to the position you gave it. An unknown name is reported in the run status rather than dropped in silence.

## Actor input object example

```json
{
  "mode": "articleTrends",
  "articles": [
    "Artificial intelligence",
    "Machine learning"
  ],
  "project": "en.wikipedia",
  "countries": [
    "US",
    "DE"
  ],
  "granularity": "daily",
  "sinceDays": 30,
  "access": "all-access",
  "agent": "user",
  "excludeNonArticles": true,
  "includeShare": true,
  "onlyNew": false,
  "maxItems": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "articles": [
        "Artificial intelligence",
        "Machine learning"
    ],
    "project": "en.wikipedia",
    "countries": [
        "US",
        "DE"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("yadroo/wikipedia-pageviews-trends").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "articles": [
        "Artificial intelligence",
        "Machine learning",
    ],
    "project": "en.wikipedia",
    "countries": [
        "US",
        "DE",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("yadroo/wikipedia-pageviews-trends").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "articles": [
    "Artificial intelligence",
    "Machine learning"
  ],
  "project": "en.wikipedia",
  "countries": [
    "US",
    "DE"
  ]
}' |
apify call yadroo/wikipedia-pageviews-trends --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,yadroo/wikipedia-pageviews-trends"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/irghxrpzCieBTG3kG/builds/47mdvEfwQrlNu06Gs/openapi.json
