# Page Weight and Carbon: transfer size, requests and CO2e (`examsens.ai/page-weight-carbon`) Actor

Loads each page in a headless browser and reports the bytes transferred by resource type, the request count, third party weight and a carbon estimate per view from the Sustainable Web Design Model v4.

- **URL**: https://apify.com/examsens.ai/page-weight-carbon.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** SEO tools, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $9.00 / 1,000 page measureds

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/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 and Carbon: transfer size, requests and CO2e

Give it a list of web pages. It loads each one in headless Chrome with an empty cache and reports how many bytes the page pulled over the network, split by resource type, how many requests it made, how much came from third parties, and an estimate of the grams of CO2e for one view using the Sustainable Web Design Model version 4 \[1].

### How the weight is measured

Every request is read from Chrome's own network events. Transfer size is the bytes on the wire: the compressed body plus headers, with redirect hops included. The decoded size (after decompression) is reported alongside. Requests are grouped as document, script, stylesheet, image, font, media, xhr (fetch, XHR and similar) and other, and split into first and third party by registrable domain. The page is measured after its load event plus a wait you set (default 3 seconds). Turn on Scroll the page to count images and videos that load only when scrolled into view.

### How the carbon estimate is made

The model and its constants come from the Sustainable Web Design Model version 4 \[1]:

- Operational energy per GB: data centers 0.055 kWh, networks 0.059 kWh, user devices 0.080 kWh.
- Embodied energy per GB: data centers 0.012 kWh, networks 0.013 kWh, user devices 0.081 kWh.
- Grid carbon intensity: 494 g CO2e per kWh, the global average the model uses by default. You can set your own.
- Green hosting factor: the share of data center energy from renewable or zero carbon sources, from 0 to 1, which reduces data center operational emissions only. Default 0.
- Bytes are converted at 1,000,000,000 bytes per GB, as in the Green Web Foundation's CO2.js implementation of the model \[3].

The estimate is for one first view with nothing cached. The grade uses the model's digital carbon rating scale for grams per page view \[2]: A+ up to 0.040, A up to 0.079, B up to 0.145, C up to 0.209, D up to 0.278, E up to 0.359, F above.

### Input

- Pages (required)
- Device: desktop (1366 by 768) or mobile (iPhone 13 profile)
- Scroll the page (default off)
- Wait after load (default 3 seconds)
- Grid carbon intensity (default 494 g CO2e per kWh)
- Green hosting factor (default 0)
- Page load timeout (default 60 seconds)

### Output

Dataset: one item per page with `url`, `ok`, `device`, `finalUrl`, `httpStatus`, `title`, `transferBytes`, `transferKB`, `decodedBytes`, `requestCount`, `failedRequests`, `unfinishedRequests` (still loading when measured, not counted in the bytes), `thirdPartyRequests`, `thirdPartyTransferBytes`, `byType` (requests, transfer bytes and decoded bytes for each type), `largestResources` (the 10 heaviest), `gramsCO2ePerView`, `carbonRating`, and `carbon` with the operational and embodied grams, the grams per segment (data center, network, user device) and the assumptions used.

A page that cannot be loaded, or answers with an HTTP error, gets `ok: false` and an `error`, and the rest of the run carries on. Export as JSON, CSV or Excel, or read it over the API.

### Pricing

Pay per event: one event per page measured. A page that fails is not charged. The run stops when it reaches the maximum charge you set.

### Scope and conduct

Only the pages you list are loaded, one at a time, each in a fresh browser. The actor does not log in anywhere, click anything, or collect personal data.

### Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.

### References

\[1] Sustainable Web Design, Estimating Digital Emissions. https://sustainablewebdesign.org/estimating-digital-emissions/

\[2] Sustainable Web Design, Introducing Digital Carbon Ratings. https://sustainablewebdesign.org/digital-carbon-ratings/

\[3] Green Web Foundation, CO2.js source, file size constants. https://github.com/thegreenwebfoundation/co2.js/blob/main/src/constants/file-size.js

# Actor input Schema

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

Web pages to measure. Each one is loaded in a fresh browser with an empty cache.

## `device` (type: `string`):

Desktop uses a 1366 by 768 window. Mobile uses an iPhone 13 profile: phone screen size and user agent.

## `scrollPage` (type: `boolean`):

Scroll to the bottom after loading, so images and videos that load only when scrolled into view are counted.

## `waitSecs` (type: `integer`):

Keep counting requests for this long after the page's load event.

## `gridIntensity` (type: `number`):

Carbon intensity of electricity used for every segment. The model's default is the global average, 494.

## `greenHostingFactor` (type: `number`):

Share of the data center's energy from renewable or zero carbon sources, from 0 to 1. It reduces data center operational emissions only, as the model defines.

## `timeoutSecs` (type: `integer`):

Give up on a page that has not loaded after this many seconds.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://apify.com"
    }
  ],
  "device": "desktop",
  "scrollPage": false,
  "waitSecs": 3,
  "gridIntensity": 494,
  "greenHostingFactor": 0,
  "timeoutSecs": 60
}
```

# Actor output Schema

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

No description

# 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": [
        {
            "url": "https://apify.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/page-weight-carbon").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": [{ "url": "https://apify.com" }] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/page-weight-carbon").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": [
    {
      "url": "https://apify.com"
    }
  ]
}' |
apify call examsens.ai/page-weight-carbon --silent --output-dataset

```

## MCP server setup

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

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/GW58QDiyBuveMAwdo/builds/NNFcpzQegfFjxQj3c/openapi.json
