# Page Weight Analyzer - Page Size & Performance Hints (`eliai/webpage-page-weight-analyzer`) Actor

Estimates the page weight of URLs, single or bulk, from one fetch with no headless browser. Returns HTML and transfer size, script, style, image and font counts, render-blocking resources and specific fixes. Failed fetches are free. For performance engineers, SEO agencies and developers.

- **URL**: https://apify.com/eliai/webpage-page-weight-analyzer.md
- **Developed by:** [Broke to Built](https://apify.com/eliai) (community)
- **Categories:** Developer tools, SEO 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 $0.80 / 1,000 scanned pages

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

## Page Weight Analyzer — page size, resource counts & performance hints

Estimate a page's **weight** and get actionable **performance hints** from a single fetch — no
headless browser. Returns HTML size, transfer (compressed) size, counts of scripts/styles/images/
fonts, render-blocking resources, and specific fixes. Single URL or bulk. **$0.001 per page.** Failed
fetches are recorded free.

### What you get

- **HTML + transfer size** (KB), with detected compression.
- **Resource counts**: external/inline scripts, external/inline styles, images, fonts.
- **Render-blocking** scripts + stylesheets in `<head>`, and scripts missing async/defer.
- **Inline JS/CSS weight** and an estimated request count.
- **Hints** — concrete, prioritized fixes.
- **Fail-soft**: an unreachable URL returns `{ok:false, error}` and is **never charged**.

### Input

```json
{ "url": "https://github.com", "urls": ["https://example.com"], "maxUrls": 25 }
```

### Output (real run, 2026-08-07)

```json
{
  "ok": true, "url": "https://github.com/", "status": 200,
  "htmlKb": 559.37, "transferKb": 559.37, "compression": "gzip",
  "counts": { "scripts": 15, "styles": 42, "images": 24, "fonts": 1 },
  "inlineJsKb": 132.57, "renderBlocking": 30, "renderBlockingStyles": 30,
  "estimatedRequests": 76,
  "hints": ["30 render-blocking stylesheet(s) in <head> — inline critical CSS and lazy-load the rest.", "…"]
}
```

### Example

A real run on 2026-10-31 with the input this page's form is prefilled with:

```json
{
  "url": "https://github.com",
  "urls": [
    "https://github.com",
    "https://wikipedia.org"
  ]
}
```

It finished in 2 seconds and returned 2 results. It was charged for 2 `page-scanned` events ($0.002 on the Free plan). The first result (long text and lists cut for display):

```json
{
  "ok": true,
  "url": "https://github.com/",
  "finalUrl": "https://github.com/",
  "status": 200,
  "contentType": "text/html",
  "htmlKb": 517.71,
  "transferKb": 517.71,
  "compression": "gzip",
  "counts": {
    "scripts": 16,
    "scriptsExternal": 8,
    "scriptsInline": 8,
    "styles": 43,
    "stylesExternal": 42,
    "stylesInline": 1,
    "images": 22,
    "fonts": 1
  },
  "inlineJsKb": 142.33,
  "inlineCssKb": 0.12,
  "renderBlocking": 29,
  "renderBlockingScripts": 0,
  "renderBlockingStyles": 29,
  "scriptsMissingAsyncDefer": 0,
  "estimatedRequests": 74,
  "hints": [
    "29 render-blocking stylesheet(s) in <head> — inline critical CSS and lazy-load the rest.",
    "Large inline JavaScript (142.33KB) — extract to a cacheable external file.",
    "HTML document is large (517.71KB) — minify markup and reduce server-rendered bloat.",
    "… 2 more"
  ],
  "fetchMs": 79,
  "scrapedAt": "2026-10-31T23:40:51.949Z"
}
```

### Pricing — $0.001 per page

A lightweight HTML-only analyzer, priced far below the Lighthouse-style actors on the Apify Store
(measured 2026-08-07: nexgendata/page-speed-analyzer $0.1/item · miccho27/seo-analyzer $0.03/item ·
alizarin pagespeed-insights $0.02/url-analysis). Those render the page in a headless browser; this one
parses the served HTML, so it is ~20–100× cheaper for a fast weight + hints pass.

### Limits (honest ones)

- Analyzes the served HTML — it does not download each sub-resource or run JavaScript, so sizes for external JS/CSS/images are counted, not summed. Use a headless Lighthouse actor for fully-rendered metrics.
- Transfer size uses the server's Content-Length, or a gzip estimate when absent.
- `maxUrls` capped at 50 per run.

### FAQ

- **Does it run Lighthouse?** No — it is a fast HTML-only pass (counts, sizes, render-blocking, hints). That is what makes it cheap.
- **Does it measure external file sizes?** It counts external resources and measures inline JS/CSS; it does not fetch each external file.
- **What about a dead URL?** You get an `{ok:false, error}` record, uncharged.

### Use from code or AI agents

```bash
curl -X POST "https://api.apify.com/v2/acts/EliAI~webpage-page-weight-analyzer/runs?token=YOUR_APIFY_TOKEN" \
  -H 'content-type: application/json' -d '{"url":"https://github.com"}'
```

Callable as an agent tool through the Apify MCP server (`mcp.apify.com`).

### Who uses it

- Performance engineers finding pages with many render-blocking scripts
- SEO agencies flagging heavy templates across a client's key URLs
- Developers comparing HTML and transfer size before and after a build change
- Sustainability teams estimating page weight across a site
- Consultants benchmarking resource counts on competitor homepages

### Changelog

- 2026-11-01: Page text only: an Example section from a real run. Code, output and price are unchanged.

# Actor input Schema

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

A single page URL to analyze. Use this or 'urls'.

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

Multiple page URLs to analyze in one run.

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

Maximum number of URLs to analyze per run.

## Actor input object example

```json
{
  "url": "https://github.com",
  "urls": [
    "https://github.com",
    "https://wikipedia.org"
  ],
  "maxUrls": 25
}
```

# Actor output Schema

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

Every item this run produced. Export as JSON, CSV or Excel from the dataset view.

# 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://github.com",
    "urls": [
        "https://github.com",
        "https://wikipedia.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/webpage-page-weight-analyzer").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://github.com",
    "urls": [
        "https://github.com",
        "https://wikipedia.org",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("eliai/webpage-page-weight-analyzer").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 '{
  "url": "https://github.com",
  "urls": [
    "https://github.com",
    "https://wikipedia.org"
  ]
}' |
apify call eliai/webpage-page-weight-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eliai/webpage-page-weight-analyzer"
        }
    }
}
```

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/gaounIdON1haJlmZR/builds/fN5DcudWTrmNXXDVg/openapi.json
