# Bulk PageSpeed Insights & Core Web Vitals Checker (`mosaicked_sponge/pagespeed-core-web-vitals-auditor`) Actor

Run Google PageSpeed Insights on hundreds of URLs or a whole sitemap. Get Lighthouse scores and real-user Core Web Vitals (LCP, INP, CLS) for mobile and desktop in CSV-ready rows, plus alerts when a page's score drops.

- **URL**: https://apify.com/mosaicked_sponge/pagespeed-core-web-vitals-auditor.md
- **Developed by:** [Jason](https://apify.com/mosaicked_sponge) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 page auditeds

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

## Bulk PageSpeed Insights & Core Web Vitals Checker

![Bulk PageSpeed Insights & Core Web Vitals Checker - sample output](https://api.apify.com/v2/key-value-stores/QpfrAb6wndEDB0tDd/records/output-pmF3fdoZX7dJgctIq.png)

Run **Google PageSpeed Insights on hundreds of pages at once**. Give it a list of URLs or a `sitemap.xml`. For every page and device (mobile and/or desktop) you get:

- **Lighthouse lab scores** (0–100): Performance, Accessibility, Best Practices, SEO.
- **Lab metrics:** FCP, LCP, TBT, CLS, Speed Index, TTI, TTFB.
- **Real-user Core Web Vitals** from the Chrome UX Report (CrUX): LCP, INP, CLS, FCP and TTFB at the 75th percentile. Each comes with a good / needs-improvement / poor rating and a Core Web Vitals **pass/fail** assessment.
- **The top 5 fixes**, ranked by estimated time saved. Examples: render-blocking requests, image delivery, unused JavaScript.
- A link to the full report on pagespeed.web.dev.

Every result is **one flat row**, ready for Excel, Google Sheets, Looker Studio or a CSV export. A ready-made `RESULTS.csv` with a fixed column order is also saved.

### Regression monitor

Set `mode` to **monitor** and schedule the Actor daily or weekly. Every page is compared with its result from the previous run, and the Actor flags:

- a Lighthouse score that dropped by **10 or more points** (you can change this threshold);
- a **Core Web Vitals assessment** that went from pass to fail;
- a **field LCP, INP or CLS rating** that got worse (for example good → needs improvement);
- **lab LCP** that grew by 50% or more and by at least 1 second.

Regressions get `regression: true` and a plain-English `regressionReasons`, such as *"performance score 92->71 (-21); field LCP good->poor"*. They also go to the `REGRESSIONS` and `REGRESSIONS.csv` records. To get emailed only when something regressed, connect an Apify integration or webhook, or filter the dataset on `regression`.

### Google API key (free, about 2 minutes)

This Actor uses Google's official **PageSpeed Insights API v5** and the **Chrome UX Report API**.

- **Without a key**, the Actor runs a **limited free preview**: it audits only the first 2 URLs with one strategy (mobile by default), so you can see real results right away. Those audits are billed like any other. OUTPUT and the log say "Ran a limited free preview; add your own free Google key for full runs". Anything past the first 2 URLs is not audited and not charged.
- **With your own free key** you get about 25,000 audits per day. No billing account is needed.

To create a key:

1. Open the [Google Cloud console](https://console.cloud.google.com/) and create a project (or pick one).
2. Enable **PageSpeed Insights API**. Optionally also enable **Chrome UX Report API** for the freshest field data.
3. Go to *APIs & Services → Credentials → Create credentials → API key*. Restricting the key to those two APIs is recommended.
4. Paste the key into **Google API key**. It is stored encrypted, sent only to Google in a request header, and never logged.

If the CrUX API isn't enabled for your key, the Actor falls back to the field data that PageSpeed Insights returns.

### Pricing

**$8.00 per 1,000 audits**, falling to $7.00 / $6.50 / $6.00 per 1,000 on Bronze / Silver / Gold+ Apify plans. One audit is one URL on one device, so mobile + desktop counts as 2.

You are **not charged** for:

- audits that fail (page didn't load, Lighthouse error);
- URLs that are blocked (private network, adult sites);
- audits skipped because the Google quota ran out or your maximum charge was reached.

For comparison, other PageSpeed Actors charge $0.03–$0.10 per page.

### Output columns

`url, strategy, finalUrl, performanceScore, accessibilityScore, bestPracticesScore, seoScore, coreWebVitals, fieldDataScope, fieldLcpP75Ms, fieldLcpRating, fieldInpP75Ms, fieldInpRating, fieldClsP75, fieldClsRating, fieldFcpP75Ms, fieldFcpRating, fieldTtfbP75Ms, fieldTtfbRating, labFcpMs, labLcpMs, labTbtMs, labCls, labSpeedIndexMs, labTtiMs, labTtfbMs, monitorStatus, regression, regressionReasons, prevPerformanceScore, performanceScoreDelta, prevCheckedAt, topOpportunities, fieldDataSource, fieldCollectionPeriod, lighthouseVersion, lighthouseWarnings, psiReportUrl, auditedAt, monitorId`

- `fieldDataScope` is `url` when the page has its own CrUX data, `origin` when site-wide data was used because the page has too little traffic, and `none` when there is no data. Low-traffic sites often have no CrUX data at all.
- `fieldDataSource` is `crux-api` or `pagespeed-api`.

### Use cases

- **Bulk PageSpeed test:** check every page in a sitemap at once instead of pasting URLs into pagespeed.web.dev one by one.
- **Core Web Vitals report** for SEO audits and client reporting. Export the CSV to Google Sheets or Looker Studio.
- **Performance regression alerts:** after deploys, theme or plugin updates, or tag-manager changes.
- **Competitor benchmarking:** compare Lighthouse and CrUX numbers across competitor sites.

### FAQ

**Is this the official Google data?**
Yes. Lab scores come from Google's PageSpeed Insights API (Lighthouse, run on Google's servers). Field data comes from the Chrome UX Report.

**Why are my field (CrUX) columns empty?**
Google only publishes real-user data for pages and sites with enough Chrome traffic. Check `fieldDataScope`: if it says `none`, there isn't enough data yet. Lab scores are still returned.

**Why do scores differ slightly from run to run?**
Lighthouse lab tests vary with network and server conditions. Use the regression threshold to ignore small swings.

**Can I run it on a schedule?**
Yes. Create an Apify schedule with `mode: monitor`, then add an email, Slack or webhook integration that fires on regressions.

### Tips and limits

- **Lab scores vary** by a few points between runs because of network and server noise. That's why the regression threshold defaults to 10 points.
- **CrUX field data is a rolling 28-day window** and is updated daily, so field ratings move slowly. Lab scores react immediately.
- **Google audits the page from its own servers.** Only public pages can be tested. Login-only pages, localhost and private IPs don't work, and private addresses are refused up front.
- **Concurrency** defaults to 6 parallel audits with a key and 2 without. Google allows about 4 requests per second per project.

### Acceptable use

- Audit only sites you own, manage, or are allowed to test.
- Adult sites and private or internal addresses are refused.
- Use of the Google APIs is subject to [Google's API Terms of Service](https://developers.google.com/terms). Your key and its quota are yours.

# Actor input Schema

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

Pages to test with PageSpeed Insights (Lighthouse + Chrome UX Report). One URL per line; https:// is added if missing.

## `sitemapUrls` (type: `array`):

Optional sitemap.xml or sitemap index URLs; every page found is audited (up to Max URLs).

## `maxUrls` (type: `integer`):

Upper limit of distinct URLs per run (each URL is audited once per strategy).

## `strategies` (type: `array`):

Mobile, desktop or both. Each URL x strategy is one audit (one result row).

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

Lighthouse categories to score (0-100). Performance is needed for lab metrics.

## `fieldData` (type: `boolean`):

Core Web Vitals p75 from the Chrome UX Report (LCP, INP, CLS, FCP, TTFB) with good / needs-improvement / poor ratings and a pass/fail assessment. Uses the CrUX API when your key allows it, otherwise PageSpeed's field data.

## `originFallback` (type: `boolean`):

When a page has too little traffic for page-level CrUX data, use the whole site's (origin) data and mark fieldDataScope = "origin".

## `psiApiKey` (type: `string`):

Your free Google Cloud API key with "PageSpeed Insights API" (and optionally "Chrome UX Report API") enabled - 25,000 audits/day, no billing needed. Get one in 2 minutes: https://developers.google.com/speed/docs/insights/v5/get-started . Stored encrypted and never logged. Without a key the Actor runs a limited free preview: only the first 2 URLs, one strategy. Add your key for full runs.

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

Monitor compares every page with its result from the previous run of the same Monitor ID and flags regressions (score drops, Core Web Vitals pass->fail, field ratings getting worse). Schedule it daily or weekly.

## `monitorId` (type: `string`):

Name of the monitor; runs with the same ID compare against each other.

## `scoreDropThreshold` (type: `integer`):

Lighthouse lab scores vary by a few points between runs; 10 avoids most false alarms.

## `labLcpIncreasePercent` (type: `integer`):

Also flag when lab LCP grows by this percentage and at least 1 second.

## `locale` (type: `string`):

Language of audit titles (e.g. en, de, fr).

## `maxConcurrency` (type: `integer`):

Default 6 with an API key, 2 without. Google allows about 4 requests per second per project.

## `maxRetries` (type: `integer`):

Retries for transient Google errors and rate limits. Failed audits are never charged.

## Actor input object example

```json
{
  "urls": [
    "https://www.python.org",
    "https://web.dev"
  ],
  "maxUrls": 500,
  "strategies": [
    "mobile"
  ],
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "fieldData": true,
  "originFallback": true,
  "mode": "audit",
  "monitorId": "default",
  "scoreDropThreshold": 10,
  "labLcpIncreasePercent": 50,
  "locale": "en",
  "maxRetries": 2
}
```

# Actor output Schema

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

One flat row per URL x strategy; export as CSV, Excel or JSON.

## `csv` (type: `string`):

RESULTS.csv with a fixed column order.

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

OUTPUT record: counts, averages, Core Web Vitals pass/fail, stop reason.

## `errors` (type: `string`):

ERRORS record: failed, blocked and skipped audits (never charged).

# 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",
        "https://web.dev"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mosaicked_sponge/pagespeed-core-web-vitals-auditor").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",
        "https://web.dev",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("mosaicked_sponge/pagespeed-core-web-vitals-auditor").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",
    "https://web.dev"
  ]
}' |
apify call mosaicked_sponge/pagespeed-core-web-vitals-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mosaicked_sponge/pagespeed-core-web-vitals-auditor"
        }
    }
}
```

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/pmF3fdoZX7dJgctIq/builds/hdJGmCrS3iP6YwQsC/openapi.json
