# PageSpeed Trend Monitor: Core Web Vitals Changes (`ucchiii/pagespeed-trend-monitor`) Actor

Track PageSpeed Insights every day with your own Google API key: mobile and desktop Performance, FCP, TBT, Speed Index, LCP, CLS, the change since the last run in values and %, Good/Poor threshold crossings flagged, and a by-date trend table. Made for Apify Schedules. Empty input = free sample.

- **URL**: https://apify.com/ucchiii/pagespeed-trend-monitor.md
- **Developed by:** [Actor Factory](https://apify.com/ucchiii) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 page measurements

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

## PageSpeed Trend Monitor — daily Core Web Vitals changes, in values and %

**For site owners, SEO teams and developers who check PageSpeed Insights every day and want to know what changed.**
Give a list of URLs and your own Google API key, schedule the Actor once a day, and every run tells you, per URL and device
(mobile and desktop):

- **Performance, FCP, TBT, Speed Index, LCP and CLS** today, the value from the **previous run**, the **change** and the **change in %**
- **Good / Needs improvement / Poor** before and after, with a flag when a metric **crosses a threshold** (for example LCP good -> needs improvement)
- a **verdict** per row: `worse`, `better`, `mixed`, `stable` or `first-run`, plus readable `alerts`
- **trend rows by date** (one row per URL, device and day) and a by-date table `TREND.csv` you can open in Excel or Google Sheets

The previous results are kept in a **named key-value store in your own Apify account**, so the comparison works across
scheduled runs. **$0.003 per page measurement** (one URL on one device). Failed measurements, a rejected key, trend rows
and the sample rows are free.

**Try it free: leave the input empty (or leave the API key empty) and press Start.** You get sample rows with fixed example
numbers (`_demo: true`); no API call is made and nothing is charged.

### Sample output

Measurement rows (the "Change since last run" view):

| url | strategy | verdict | performanceScore | performanceScoreChangePct | lcpMs | lcpMsPrev | lcpMsChangePct | lcpMsRatingPrev | lcpMsRating | cls | clsChangePct |
|---|---|---|---|---|---|---|---|---|---|---|---|
| https://www.python.org | mobile | mixed | 92 | 5.7 | 3151 | 3789 | -16.8 | needs-improvement | needs-improvement | 0.0359 | 1280.8 |

*(real row from two runs on Apify on 2026-11-13, a few minutes apart; percentages on tiny values such as CLS can look large)*

`alerts` for this row:

```json
["Performance better: needs-improvement -> good (87 -> 92, +5.7%)", "LCP better: 3789 ms -> 3151 ms, -16.8%", "CLS worse: 0.0026 -> 0.0359, +1280.8%"]
```

Trend rows (the "Trend by date" view; fixed example numbers, the same as the free sample rows):

| date | url | strategy | performanceScore | performanceScoreChangePct | lcpMs | lcpMsChangePct | cls |
|---|---|---|---|---|---|---|---|
| 2026-11-11 | https://www.example.com/ | mobile | 78 | | 2380 | | 0.04 |
| 2026-11-12 | https://www.example.com/ | mobile | 76 | -2.6 | 2450 | 2.9 | 0.04 |
| 2026-11-13 | https://www.example.com/ | mobile | 64 | -15.8 | 2910 | 18.8 | 0.04 |

### Set it up to run every day (Apify Schedules)

1. **Get a Google API key.** In the Google Cloud console, open a project, go to *APIs & Services > Library*, enable
   **PageSpeed Insights API**, then *APIs & Services > Credentials > Create credentials > API key*. Restricting the key
   to the PageSpeed Insights API is a good idea. The key belongs to you; its quota and any costs are on your Google project.
2. **Create a task.** Open this Actor in Apify Console, fill in `urls` and `apiKey` (stored encrypted as a secret input),
   choose the device, and set a `historyStoreName` such as `my-site-pagespeed`. Click *Save as a new task*.
3. **Run the task once** to create the history (all rows say `first-run`).
4. **Schedule it.** In Console go to *Schedules > Create new*, choose a daily time (for example `0 6 * * *` = every day
   06:00 UTC), and add your task. From the next run on, each row compares with the previous run.
5. **Get told about changes (optional).** On the task, add an integration or webhook (for example email or Slack on
   *Run succeeded*), and look at the `verdict`, `alerts` and `worseMetrics` fields, or at `SUMMARY` (counts of worse,
   better, stable rows).

Keep the same `historyStoreName` in every run that should be compared. Use different names for different sites or clients.

### Input

```json
{
  "urls": ["https://www.example.com/", "https://www.example.com/pricing"],
  "apiKey": "<your Google API key>",
  "strategy": "both",
  "historyStoreName": "my-site-pagespeed",
  "historyDays": 90,
  "trendDays": 7,
  "minChangePct": 10,
  "concurrency": 3
}
```

| Field | What it does |
|---|---|
| `urls` | Up to 200 URLs per run, `http` or `https`. Only measure pages you are allowed to test. |
| `apiKey` | **Required to measure.** Your own key with the PageSpeed Insights API enabled. Without it you only get the free sample rows. |
| `strategy` | `both` (default), `mobile` or `desktop`. `both` is two measurements per URL. |
| `historyStoreName` | Key-value store in your account that keeps the previous results (default `pagespeed-trend-history`). |
| `historyDays` | Days of history kept per URL and device, 1 to 400 (default 90). One entry per day; a second run on the same day replaces it. |
| `trendDays` | Trend rows per URL and device in the dataset, 0 to 90 (default 7). `TREND.csv` always has the whole kept history. |
| `minChangePct` | A change of at least this % (default 10) is flagged, as is any threshold crossing. |
| `concurrency` | Parallel measurements, 1 to 5 (default 3). |

### Output fields

Measurement rows (`rowType: "measurement"`), for each of `performanceScore`, `fcpMs`, `tbtMs`, `speedIndexMs`, `lcpMs`,
`cls` and the real-user (CrUX) `fieldLcpMs`, `fieldInpMs`, `fieldCls` when Google has them:

- `<metric>` (today), `<metric>Prev`, `<metric>Change`, `<metric>ChangePct`, `<metric>Rating`, `<metric>RatingPrev`
- `verdict`, `worseMetrics`, `betterMetrics`, `alerts`, `firstRun`, `previousCheckedAt`
- `url`, `strategy`, `date` (UTC), `checkedAt`, `finalUrl`, `error`

Trend rows (`rowType: "trend"`): `date`, `url`, `strategy`, the metrics, and the % change of the lab metrics against the
previous date.

Key-value store of the run: `TREND.csv` (one line per URL, device and metric, one column per date) and `SUMMARY`.

#### How the ratings are decided

- FCP: good up to 1,800 ms, needs improvement up to 3,000 ms, poor above. LCP: 2,500 / 4,000 ms. CLS: 0.1 / 0.25.
  INP (field): 200 / 500 ms. These are the thresholds published in the PageSpeed Insights documentation.
- Performance score: 90+ good, 50–89 needs improvement, below 50 poor.
- TBT and Speed Index: from the Lighthouse metric score in the same response (0.9+ good, 0.5+ needs improvement), which is
  how the PageSpeed Insights report colours them.
- A change is flagged when it is at least `minChangePct` **and** larger than a small absolute amount (3 score points,
  100 ms, 50 ms for TBT, 0.02 for CLS), so that CLS 0.001 -> 0.002 (+100%) is not reported as a regression.

### Pricing

- **$0.003 per page measurement** (one URL on one device, measured successfully). 1 URL on mobile and desktop every day
  for 30 days = 60 measurements = **$0.18**. 20 URLs on both devices daily = about **$3.60 a month**.
- Free: sample rows, runs without an API key, rejected keys, quota errors, failed measurements, invalid URLs, trend rows,
  `TREND.csv`.
- Google does not charge this Actor for anything: the calls are made with your key against your Google project quota.

### FAQ

**Why do I need my own API key?** The Actor never uses a shared or built-in key. Your key gives you your own quota
(Google shows it in the Cloud console under *Quotas*) and keeps the use under your Google account, as Google's API terms expect.

**Is my key safe?** It is a secret input (encrypted by Apify). The Actor sends it only to Google's PageSpeed Insights
endpoint and never writes it to the log, the dataset, `SUMMARY`, `TREND.csv` or the history store. Errors are reported as
short codes only.

**What happens on the first run?** There is nothing to compare with yet, so every row is `first-run` with the current
values and ratings. The next run compares with it.

**I ran it twice today.** The second run compares with the first one, and replaces today's entry in the history (one
entry per day is kept).

**Scores jump around without any change on my site.** Lighthouse lab scores vary from run to run. Raise `minChangePct`
(for example 15 or 20) and look at `worseMetrics` over several days in the trend rows before acting.

**What errors can I see?** `api_key_invalid` (Google rejected the key), `api_key_forbidden_or_api_disabled` (the
PageSpeed Insights API is not enabled for the key's project, or the key is restricted), `daily_quota_exceeded`,
`rate_limited`, `timeout`, `page_unreachable_or_invalid`, `invalid_url`, `blocked_private_address`. After a key or daily
quota error the rest of the run is skipped. All of these are free.

### Notes and limits

- Data source: the Google PageSpeed Insights API v5 (`https://www.googleapis.com/pagespeedonline/v5/runPagespeed`), called
  with your key and `category=performance`. Google loads and measures the page; this Actor does not fetch it.
- This Actor is not affiliated with, sponsored or endorsed by Google. Your use of the API is under your Google account
  and the Google APIs Terms of Service.
- Results stay in your Apify account: the run's dataset and key-value store, and the named history store. The history
  keeps numbers only (scores, metrics and ratings), not the Lighthouse report. Delete the history store in Console
  (*Storage > Key-value stores*) whenever you want to start over.
- The history store must be created by this Actor (use a new name). A store created by another Actor may not be readable.
- Up to 200 URLs per run; each call has a 90 second timeout; 429 and 5xx responses are retried with backoff.
- Lab results come from a single Lighthouse run per URL and device; field data is the 28-day CrUX p75 when available.
- When testing this Actor without a key (for example Apify's automatic checks), it returns the free sample rows.

### More tools from the same developer

- [SEO Audit Tool](https://apify.com/ucchiii/seo-audit-tool) — on-page SEO audit for URL lists and sitemaps: title, meta description, h1, canonical, noindex, robots.txt, issues and a 0-100 score
- [Bulk URL Status Checker](https://apify.com/ucchiii/url-status-checker) — bulk HTTP status and redirect-chain checker for URL lists
- [Sitemap URL Extractor](https://apify.com/ucchiii/sitemap-urls) — list every URL of a website from its sitemaps
- [Redirect Checker](https://apify.com/ucchiii/redirect-checker) — full redirect chain for each URL, hop by hop, with loop detection
- [Website Screenshot](https://apify.com/ucchiii/website-screenshot) — screenshots and PDFs of web pages: full page, mobile, element, no cookie banners

# Actor input Schema

## `urls` (type: `array`):

Full URLs including http:// or https:// (your own pages, or pages you are allowed to test). Up to 200 URLs per run. Private or internal hosts are rejected. Leave empty, or leave the API key empty, to see free sample rows (no API call, not charged).

## `apiKey` (type: `string`):

Your own Google Cloud API key with the PageSpeed Insights API enabled (Google Cloud console > APIs & Services). Required: this Actor never uses a shared or built-in key. The key is only sent to Google for this run and is never written to logs, the dataset or the history store. Without a key you get free sample rows only.

## `strategy` (type: `string`):

Which Lighthouse device profile to measure. 'Mobile and desktop' measures each URL twice (two charged measurements per URL).

## `historyStoreName` (type: `string`):

Name of the key-value store in your Apify account where the previous results are kept between runs (created on the first run). Use the same name in every scheduled run to compare with the last run; use different names for separate projects or clients. Letters a-z, digits and hyphens, up to 63 characters.

## `historyDays` (type: `integer`):

How many days of results to keep per URL and device in the history store (one entry per day; a second run on the same day replaces that day's entry). Older entries are deleted. Allowed range 1 to 400 (default 90).

## `trendDays` (type: `integer`):

How many recent days to output as trend rows (rowType 'trend', one row per date, free). 0 = no trend rows. The full kept history is also saved as a by-date table in the TREND.csv record of the run's key-value store. Allowed range 0 to 90 (default 7).

## `minChangePct` (type: `integer`):

A metric is listed in worseMetrics or betterMetrics when it changed by at least this percentage since the previous run (and by a small absolute amount, so noise like CLS 0.001 to 0.002 is ignored), or when it crossed a Good / Needs improvement / Poor threshold. Lighthouse scores vary between runs on their own, so 10 or more is a sensible start. Default 10.

## `concurrency` (type: `integer`):

How many measurements run in parallel. Allowed range 1 to 5 (default 3). Each measurement takes about 10 to 60 seconds on Google's side.

## Actor input object example

```json
{
  "urls": [
    "https://www.python.org/"
  ],
  "strategy": "both",
  "historyStoreName": "pagespeed-trend-history",
  "historyDays": 90,
  "trendDays": 7,
  "minChangePct": 10,
  "concurrency": 3
}
```

# Actor output Schema

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

Measurement rows (one per URL and device: values, previous values, change, change %, Good / Needs improvement / Poor before and after, verdict, alerts) followed by trend rows (one per date). Download as CSV, JSON or Excel from here.

## `trendCsv` (type: `string`):

Record TREND.csv: one line per URL, device and metric, one column per date for the whole kept history.

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

Record SUMMARY: measured, failed, charged, worse / better / mixed / stable / first-run counts, errors by code, history store name.

# 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 = {
    "urls": [
        "https://www.python.org/"
    ],
    "strategy": "both",
    "historyStoreName": "pagespeed-trend-history",
    "historyDays": 90,
    "trendDays": 7,
    "minChangePct": 10,
    "concurrency": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/pagespeed-trend-monitor").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 = {
    "urls": ["https://www.python.org/"],
    "strategy": "both",
    "historyStoreName": "pagespeed-trend-history",
    "historyDays": 90,
    "trendDays": 7,
    "minChangePct": 10,
    "concurrency": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/pagespeed-trend-monitor").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 '{
  "urls": [
    "https://www.python.org/"
  ],
  "strategy": "both",
  "historyStoreName": "pagespeed-trend-history",
  "historyDays": 90,
  "trendDays": 7,
  "minChangePct": 10,
  "concurrency": 3
}' |
apify call ucchiii/pagespeed-trend-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ucchiii/pagespeed-trend-monitor"
        }
    }
}
```

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/AUsgHxeZIlhmkL3oE/builds/BRspYbK1rPjNHdCiw/openapi.json
