# PageSpeed and Core Web Vitals Monitor (`kmswiill/pagespeed-core-web-vitals-monitor`) Actor

Audits pages with Google's PageSpeed Insights API and adds what a single audit cannot show: 40 weeks of Core Web Vitals history from the Chrome UX Report and a flag for pages that improved or regressed since your last run.

- **URL**: https://apify.com/kmswiill/pagespeed-core-web-vitals-monitor.md
- **Developed by:** [KmS](https://apify.com/kmswiill) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.85 / 1,000 page audits

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 and Core Web Vitals Monitor

Audit a list of pages with Google's official **PageSpeed Insights API** and get, for each page, what a single audit
cannot show: **40 weeks of Core Web Vitals history** from the Chrome UX Report and **what changed since your last
run**.

One row per page and device: the four Lighthouse scores, the lab metrics, the Core Web Vitals of real visitors with
a pass or fail assessment, the trend of each metric over the last ten months, the top fixes, and a flag when the
page improved or regressed.

### What you can do with it

- Show a client or a prospect how their Core Web Vitals evolved since the start of the year, on the first run.
- Schedule a weekly run of your key pages and get a flag on the ones that regressed.
- Compare pages before and after a release.
- Check which pages of a site pass Google's Core Web Vitals assessment.
- Export scores, metrics and fixes to a spreadsheet or to your own dashboard.

### Input

| Field | What it does |
|---|---|
| Pages to audit | One page address per line. |
| Google API key | Your free Google API key. See "The Google API key" below. |
| Device | Phone, desktop, or both (two rows per page). |
| Scores | Performance, accessibility, best practices and SEO. Performance is always included. |
| Include the 40 week history | Adds the history of the real visitor metrics. |
| Include what to fix | Adds the top speed improvements and the failed checks of the other categories. |
| Score change that counts | Points the performance score has to move to be flagged. Default 10. |

Example:

```json
{
    "urls": ["https://example.com/", "https://example.com/pricing"],
    "strategy": "both",
    "googleApiKey": "YOUR_KEY"
}
```

### Output

One row per page and device. The main fields:

```json
{
    "url": "https://example.com/pricing",
    "device": "mobile",
    "performanceScore": 63,
    "accessibilityScore": 95,
    "bestPracticesScore": 100,
    "seoScore": 92,
    "labLcpMs": 3890,
    "labFcpMs": 1610,
    "labTbtMs": 410,
    "labCls": 0.02,
    "labSpeedIndexMs": 4120,
    "labServerResponseMs": 240,
    "pageWeightBytes": 1871037,
    "fieldSource": "url",
    "fieldLcpMs": 2310,
    "fieldInpMs": 238,
    "fieldCls": 0.04,
    "fieldLcpRating": "good",
    "fieldInpRating": "needs-improvement",
    "fieldClsRating": "good",
    "coreWebVitals": "failed",
    "historySource": "url",
    "historyWeeks": 40,
    "historyFrom": "2026-02-14",
    "historyTo": "2026-11-14",
    "historyStartLcpMs": 4150,
    "historyEndLcpMs": 2325,
    "historyStartCoreWebVitals": "failed",
    "historyEndCoreWebVitals": "failed",
    "lcpTrend": "improved",
    "inpTrend": "stable",
    "clsTrend": "worsened",
    "history": [{ "week": "2026-02-14", "lcpMs": 4200, "inpMs": 180, "cls": 0.05 }],
    "opportunities": [{ "id": "render-blocking-insight", "title": "Render-blocking requests", "detail": "Est savings of 860 ms", "savingsMs": 850, "savingsBytes": null }],
    "failedAudits": { "accessibility": [], "bestPractices": [], "seo": ["Document does not have a meta description"] },
    "change": "regressed",
    "previousPerformanceScore": 80,
    "performanceScoreChange": -17,
    "previousCoreWebVitals": "failed",
    "lighthouseVersion": "13.6.0",
    "auditedAt": "2026-11-22T07:00:05.000Z"
}
```

#### Lab data and real visitor data

- **Lab** fields (`lab...`, `performanceScore`) come from one Lighthouse audit run by Google at the moment of the
  request, on a simulated phone or desktop. They change a little on every audit.
- **Field** fields (`field...`, `coreWebVitals`) are what real Chrome users experienced over the last 28 days, at
  the 75th percentile. These are the numbers Google uses to assess Core Web Vitals. `fieldSource` tells whether
  they belong to the page itself (`url`) or to the whole site (`origin`), which Google uses when the page alone has
  too few visits. Pages and sites with little traffic have no field data, and those fields are `null`.
- `coreWebVitals` is `passed` when LCP is at most 2.5 s, INP at most 200 ms and CLS at most 0.1.

#### The 40 week history

For every page, the Actor asks the Chrome UX Report History API for the weekly readings of LCP, INP and CLS over
the last 40 weeks, about ten months.

- `historyStart...` and `historyEnd...` are the averages of the first four and of the last four weekly readings.
- `lcpTrend`, `inpTrend` and `clsTrend` are `improved`, `worsened` or `stable`. A metric counts as changed when it
  moved at least 10% and at least 200 ms (LCP), 30 ms (INP) or 0.02 (CLS). Trends need at least 8 weekly readings.
- `history` holds every weekly reading, ready to be charted.
- `historySource` is `url` or `origin`, as above. It is `null` when Google has no history for the page or the site.

#### Changes between runs

The Actor remembers the last audit of each page and device in a named key-value store in your account
(`pagespeed-core-web-vitals-monitor-state`).

| `change` | Meaning |
|---|---|
| `new` | First audit of this page and device. |
| `regressed` | The performance score dropped by the threshold or more, or Core Web Vitals went from passed to failed. |
| `improved` | The performance score rose by the threshold or more, or Core Web Vitals went from failed to passed. |
| `null` | No change that counts. |

The performance score of an unchanged page moves a few points from one audit to the next. To avoid false alarms,
a move of the threshold or more is checked with a second audit, and the audit closer to the previous score is the
one that counts.

A summary of the run is saved in the key-value store under `SUMMARY`, with the pages that regressed, the pages that
could not be audited and the reason for each.

### The Google API key

The audits are made by Google, and Google asks for an API key to accept them. The key is free and takes a few
minutes to create:

1. Open the [Google Cloud console](https://console.cloud.google.com/) and create a project.
2. In "APIs & Services", open "Library" and enable the **PageSpeed Insights API** and the **Chrome UX Report API**.
3. In "APIs & Services", open "Credentials", click "Create credentials" and choose "API key". Under "Select API
   restrictions", pick those two APIs, then click "Create" and copy the key.
4. Paste it in the "Google API key" field. It is stored encrypted.

With your own key you get your own quota, which you can follow in the Google Cloud console. If only the PageSpeed
Insights API is enabled, the audits work and the history is left out.

### Pricing

You pay per audit delivered to the dataset, plus a small fee per run. Pages that could not be audited are listed in
`SUMMARY` and are not charged. Set a maximum cost per run in the run options and the Actor audits only as many
pages as that limit covers.

### Notes and limits

- Google needs 15 to 60 seconds per page and device, and a heavy page can take up to two minutes. Audits run six
  at a time.
- A page that Google cannot load, for example one behind a login or one that answers with an error, is reported in
  `SUMMARY` with Google's explanation.
- Lab scores depend on Google's test machines and network. Compare a page with its own previous audits, not with
  audits made by other tools.
- This Actor is an independent tool. It is not affiliated with, sponsored by or endorsed by Google.

### FAQ

**Is this the same data as pagespeed.web.dev?**
Yes. The Actor calls the same PageSpeed Insights API, and the history comes from the Chrome UX Report, which is the
data source behind the Core Web Vitals report.

**Why are the field values empty for my page?**
Google publishes real visitor data only for pages and sites with enough Chrome traffic.

**How do I monitor pages every week?**
Save a task with your pages and add a schedule. Each run compares every page with the previous run and fills in
`change`. The pages that regressed are also listed in `SUMMARY`.

**I need another field.**
Open an issue on the Issues tab and it will be considered for the next version.

# Actor input Schema

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

One page address per line, for example https://example.com/pricing. Each page is audited by Google, which takes 15 to 60 seconds per page and device.

## `googleApiKey` (type: `string`):

Your free Google API key with the PageSpeed Insights API and the Chrome UX Report API enabled. It gives you your own quota. The key is stored encrypted and is used only to call these two Google APIs.

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

Audit the pages as a phone, as a desktop computer, or both. Both returns two rows per page.

## `categories` (type: `array`):

Which Lighthouse scores to compute. Performance is always included. Fewer scores make each audit a little faster.

## `includeHistory` (type: `boolean`):

Add how the Core Web Vitals of real visitors evolved over the last 40 weeks, from the Chrome UX Report: the values at the start and at the end of the period, the trend of each metric and the weekly readings.

## `includeFixes` (type: `boolean`):

Add the top speed improvements suggested by Lighthouse, with the estimated saving of each, and the checks that failed in accessibility, best practices and SEO.

## `changeThreshold` (type: `integer`):

How many points the performance score has to move since your previous run to be reported as improved or regressed. Scores move a few points between audits of an unchanged page, so values under 5 produce false alarms.

## Actor input object example

```json
{
  "urls": [
    "https://www.wikipedia.org/"
  ],
  "strategy": "mobile",
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "includeHistory": true,
  "includeFixes": true,
  "changeThreshold": 10
}
```

# Actor output Schema

## `audits` (type: `string`):

One item per page and device, with the Lighthouse scores, lab and real visitor metrics, the 40 week history and what changed since the previous run.

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

Pages that regressed, pages that could not be audited and the reason, and pages that were skipped.

# 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.wikipedia.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kmswiill/pagespeed-core-web-vitals-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.wikipedia.org/"] }

# Run the Actor and wait for it to finish
run = client.actor("kmswiill/pagespeed-core-web-vitals-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.wikipedia.org/"
  ]
}' |
apify call kmswiill/pagespeed-core-web-vitals-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kmswiill/pagespeed-core-web-vitals-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/EceaeEuRycE76NWeh/builds/EOH6VD5dlAt9qcC81/openapi.json
