# Web Vitals Reporter (`pattonholdings/web-vitals-reporter`) Actor

Measure Core Web Vitals for any URL in a real Chromium browser: LCP, CLS, INP, FCP, TTFB with Google good/needs-improvement/poor ratings and A-F grade. Use for performance audits, SEO checks, competitor benchmarks. Input: url or urls\[]. Output: JSON metrics.

- **URL**: https://apify.com/pattonholdings/web-vitals-reporter.md
- **Developed by:** [Coleton Patton](https://apify.com/pattonholdings) (community)
- **Categories:** SEO tools, Developer tools
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 url scanneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Web Vitals Reporter

Measure Google Core Web Vitals (LCP, CLS, INP, FCP, TTFB) for any URL using a real Chromium browser, with per-metric pass/needs-improvement/poor classification and an overall A-F grade.

### What it does

Loads the URL in headless Chromium, injects Google's `web-vitals` library, simulates user scroll + mouse movement to trigger INP measurement, and returns a structured report.

Each metric is classified per [Google's 2026 thresholds](https://web.dev/articles/vitals):

| Metric | Good | Needs improvement | Poor |
|---|---|---|---|
| LCP | ≤ 2.5 s | ≤ 4.0 s | > 4.0 s |
| CLS | ≤ 0.1 | ≤ 0.25 | > 0.25 |
| INP | ≤ 200 ms | ≤ 500 ms | > 500 ms |
| FCP | ≤ 1.8 s | ≤ 3.0 s | > 3.0 s |
| TTFB | ≤ 0.8 s | ≤ 1.8 s | > 1.8 s |

### Input

```json
{ "url": "https://example.com" }
```

Batch mode:

```json
{ "urls": ["https://a.com", "https://b.com"] }
```

### Output

```json
{
  "url": "https://example.com",
  "grade": "B",
  "percentage": 75,
  "lcp": 1850, "lcpStatus": "good",
  "cls": 0.08, "clsStatus": "good",
  "inp": 220, "inpStatus": "needs-improvement",
  "fcp": 1200, "fcpStatus": "good",
  "ttfb": 450, "ttfbStatus": "good",
  "measuredAt": "2026-06-17T04:30:00.000Z",
  "durationMs": 14500
}
```

### Use cases

- **Performance CI** — schedule a daily run against your production pages, alert if grade drops
- **Competitive analysis** — measure your top 10 competitors weekly
- **Lead enrichment** — find sites failing Web Vitals (they need a perf consultant)
- **SEO audits** — Web Vitals is a Google ranking signal

### Pricing model (when published)

Pay-per-result: **$0.15 per URL measured.** Each measurement takes ~15-20 seconds (real Chromium).

### Why this instead of PageSpeed Insights API?

- **No quota cap** — PSI is rate-limited; this Actor scales horizontally
- **Custom interactions** — extend `main.js` to scroll a specific way, click a CTA, then measure post-interaction vitals
- **Includes TTFB and FCP** — PSI only reports the Core 3
- **Real browser** — no estimated lab metrics; field-style measurement on each run

### Author note

Built by [Peak Post](https://peakpost.ca) — solo developer running 22 Chrome extensions. Ports the always-visible Web Vitals badge from the Web Vitals Lite Chrome extension into a programmatic API.

### Roadmap

- v1.1: throttling presets (slow 3G, fast 3G, no throttle)
- v1.2: device emulation (mobile / desktop / tablet)
- v1.3: filmstrip screenshots at LCP / FCP timestamps
- v2.0: sitemap-aware batch with parallel browser pool

# Actor input Schema

## `url` (type: `string`):

A single page URL to measure.

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

Array of URLs (max 1000).

## Actor input object example

```json
{
  "url": "https://example.com"
}
```

# 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 = {
    "url": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("pattonholdings/web-vitals-reporter").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 = { "url": "https://example.com" }

# Run the Actor and wait for it to finish
run = client.actor("pattonholdings/web-vitals-reporter").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "url": "https://example.com"
}' |
apify call pattonholdings/web-vitals-reporter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=pattonholdings/web-vitals-reporter",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Fh3Jl1V6cbFtFZmqk/builds/yO9L8YcuNydBxp4Dt/openapi.json
