# Wikipedia Pageviews Trend Tracker (`sourcewise/wikipedia-pageviews-trends`) Actor

Weekly Wikipedia pageview totals, 4-week trend, rank and a 0-100 interest index for chosen articles, from official Wikimedia data. Optional rank-change alerts for webhooks.

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

## Pricing

from $1.40 / 1,000 results

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 Trend Tracker

Track weekly Wikipedia pageview totals, 4-week trends, rank, and a 0-100 interest index for any set of articles across Wikipedia language editions. Data comes from the official Wikimedia REST API.

Built for content teams, researchers, SEOs, and product managers who need to monitor topic interest over time without building their own data pipeline.

Data © Wikimedia Foundation, CC BY-SA 3.0.

### Use cases

- Compare interest in competing technologies, brands, or public figures week over week.
- Spot rising or fading topics before they show up in search trends.
- Feed a dashboard or alert system when an article's rank shifts.
- Correlate external events (launches, news, seasonality) with Wikipedia attention.

### Input

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `pages` | array | Yes | List of articles as `language:Title` (e.g. `en:JavaScript`), a plain title (defaults to English), or a full Wikipedia link like `https://de.wikipedia.org/wiki/Berlin`. Use underscores for spaces in titles. |
| `startDate` | string | No | First day of the range, `YYYY-MM-DD`. If omitted, the range is calculated from `weeks` ending 2 days ago. Data is usually available a few days behind today. |
| `endDate` | string | No | Last day of the range, `YYYY-MM-DD`. If omitted, the range ends 2 days ago. |
| `weeks` | integer | No | Number of full weeks to fetch when `startDate` and `endDate` are not provided. Defaults to 8, minimum 5. The range ends 2 days ago to account for Wikipedia's data lag. |
| `onlyRankChanges` | boolean | No | When true, the change feed lists only pages whose rank moved since the previous run. A run with no changes still succeeds with an empty feed. |

**Example input (tested and returns data today):**

{
"pages": \["en:JavaScript", "https://de.wikipedia.org/wiki/Berlin", "Python\_(programming_language)"],
"weeks": 8,
"onlyRankChanges": false,
"maxItems": 100
}

### Output

Each result contains:

| Field | Type | Description |
|-------|------|-------------|
| `rank` | number | Position among the requested pages by latest weekly views, 1 = most viewed. |
| `language` | string | Wikipedia language code, e.g. `en`. |
| `article` | string | Article title as on Wikipedia. |
| `url` | string | Link to the article on its Wikipedia edition. |
| `latestWeekViews` | number | Total pageviews in the most recent full 7-day week in the range. |
| `weeklyTotals` | array | Weekly pageview totals across the range, oldest first, each with `weekStart` and `views`. |
| `trend4WeekPercent` | number | Percent change of the latest week versus the average of the four weeks before it. Null if fewer than five full weeks. |
| `interestIndex` | number | Normalized 0-100 index: the top page in the list scores 100, others scale against it using latest weekly views. |
| `previousRank` | number | Rank in the previous run for the same pages, if known. |

**Example output (real data from the example input):**

\[
{
"rank": 1,
"language": "en",
"article": "Wikipedia",
"url": "https://en.wikipedia.org/wiki/Wikipedia",
"latestWeekViews": 341862,
"weeklyTotals": \[
{
"weekStart": "2023-12-01",
"views": 347213
},
{
"weekStart": "2023-12-08",
"views": 326224
},
{
"weekStart": "2023-12-15",
"views": 323642
},
{
"weekStart": "2023-12-22",
"views": 319879
},
{
"weekStart": "2023-12-29",
"views": 341862
}
],
"trend4WeekPercent": 3.83,
"interestIndex": 100,
"previousRank": null
},
{
"rank": 2,
"language": "en",
"article": "Python\_(programming_language)",
"url": "https://en.wikipedia.org/wiki/Python\_(programming_language)",
"latestWeekViews": 74755,
"weeklyTotals": \[
{
"weekStart": "2023-12-01",
"views": 88059
},
{
"weekStart": "2023-12-08",
"views": 81875
},
{
"weekStart": "2023-12-15",
"views": 77207
},
{
"weekStart": "2023-12-22",
"views": 88507
},
{
"weekStart": "2023-12-29",
"views": 74755
}
],
"trend4WeekPercent": -10.91,
"interestIndex": 21.87,
"previousRank": null
}
]

### Pricing

About $2 per 1,000 results (pay per result). You are charged only for the dataset items produced.

### Limits

- Minimum 5 weeks of data when using the `weeks` parameter.
- Data availability lags roughly 2 days behind today.
- Rate limited by Wikimedia's public API; large batches may take longer.
- Rank-change tracking (`onlyRankChanges`) requires at least two runs with the same page set.
- Maximum 100 pages per run via `maxItems` (default).

### Example output

```json
[
  {
    "rank": 1,
    "language": "en",
    "article": "Wikipedia",
    "url": "https://en.wikipedia.org/wiki/Wikipedia",
    "latestWeekViews": 341862,
    "weeklyTotals": [
      {
        "weekStart": "2023-12-01",
        "views": 347213
      },
      {
        "weekStart": "2023-12-08",
        "views": 326224
      },
      {
        "weekStart": "2023-12-15",
        "views": 323642
      },
      {
        "weekStart": "2023-12-22",
        "views": 319879
      },
      {
        "weekStart": "2023-12-29",
        "views": 341862
      }
    ],
    "trend4WeekPercent": 3.83,
    "interestIndex": 100,
    "previousRank": null
  },
  {
    "rank": 2,
    "language": "en",
    "article": "Python_(programming_language)",
    "url": "https://en.wikipedia.org/wiki/Python_(programming_language)",
    "latestWeekViews": 74755,
    "weeklyTotals": [
      {
        "weekStart": "2023-12-01",
        "views": 88059
      },
      {
        "weekStart": "2023-12-08",
        "views": 81875
      },
      {
        "weekStart": "2023-12-15",
        "views": 77207
      },
      {
        "weekStart": "2023-12-22",
        "views": 88507
      },
      {
        "weekStart": "2023-12-29",
        "views": 74755
      }
    ],
    "trend4WeekPercent": -10.91,
    "interestIndex": 21.87,
    "previousRank": null
  }
]
```

# Actor input Schema

## `pages` (type: `array`):

List of articles as language:Title (e.g. en:JavaScript), a plain title (defaults to English Wikipedia), or a full Wikipedia link like https://de.wikipedia.org/wiki/Berlin. Use underscores for spaces in titles.

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

First day of the range, YYYY-MM-DD. If omitted, the range is calculated from 'weeks' ending 2 days ago. Data is usually available a few days behind today.

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

Last day of the range, YYYY-MM-DD. If omitted, the range ends 2 days ago. Data is usually available a few days behind today.

## `weeks` (type: `integer`):

Number of full weeks to fetch when startDate and endDate are not provided. Defaults to 8, minimum 5. The range ends 2 days ago to account for Wikipedia's data lag.

## `onlyRankChanges` (type: `boolean`):

When on, the change feed lists only pages whose rank moved since the previous run. A run with no changes still succeeds with an empty feed.

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

Stop after this many results (you pay per result).

## Actor input object example

```json
{
  "pages": [
    "en:JavaScript",
    "https://de.wikipedia.org/wiki/Berlin",
    "Python_(programming_language)"
  ],
  "weeks": 8,
  "onlyRankChanges": false,
  "maxItems": 100
}
```

# Actor output Schema

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

One item per result, with: rank, language, article, url, latestWeekViews, weeklyTotals, trend4WeekPercent, interestIndex, previousRank.

## `summary` (type: `string`):

How many results the run returned, and when it finished.

# 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 = {
    "pages": [
        "en:JavaScript",
        "https://de.wikipedia.org/wiki/Berlin",
        "Python_(programming_language)"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sourcewise/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 = { "pages": [
        "en:JavaScript",
        "https://de.wikipedia.org/wiki/Berlin",
        "Python_(programming_language)",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sourcewise/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 '{
  "pages": [
    "en:JavaScript",
    "https://de.wikipedia.org/wiki/Berlin",
    "Python_(programming_language)"
  ]
}' |
apify call sourcewise/wikipedia-pageviews-trends --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sourcewise/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/UJqloG8mgFkH3wxsQ/builds/aZdUPBg1VUekcEdti/openapi.json
