Data Tools for All

Audit every page of a sitemap with Lighthouse for about $1

This guide takes the pages listed in a website’s sitemap, runs a mobile Lighthouse audit on 50 of them, and ranks them by performance. It uses two Apify Actors that I built and earn from: Sitemap Extractor and Bulk Lighthouse & PageSpeed Audit. If you only need one or two pages, use Lighthouse in Chrome DevTools or pagespeed.web.dev instead: they are free.

What it costs

Step Count Price Cost
List the sitemap’s URLs (optional) up to 500 URLs $0.0002 per URL at most $0.10
Lighthouse, mobile only 50 audits $0.02 per audit $1.00
Apify start fee 1 or 2 runs a fraction of a cent under $0.01
Total     about $1.00 to $1.10

Variations:

Apify’s free plan includes $5 of monthly usage credit, which covers this guide several times.

Before you start

Step 1 (optional): choose the 50 pages

The Lighthouse Actor can read the sitemap itself (Step 2, option B), but it then takes the first 50 pages it finds, which are often all of one type. A better sample covers each page template. List the URLs first:

{
  "startUrls": ["https://www.example.com"],
  "maxUrlsPerSite": 500,
  "excludePatterns": ["/tag/", "/page/\\d+"]
}

Run Sitemap Extractor with this input (at most $0.10). Each output row has url, lastmod, sitemapUrl, changefreq and priority. Group the URLs by path pattern (/blog/..., /product/..., /category/...) and pick a few from each group, up to 50. To focus on recent changes, add "lastmodAfter": "30 days".

Step 2: run the audits

Option A, your own list (recommended):

{
  "urls": ["https://www.example.com/", "https://www.example.com/pricing", "..."],
  "strategies": ["mobile"],
  "budgets": { "performanceScore": 70, "lcpMs": 2500, "cls": 0.1 }
}

Option B, straight from the sitemap:

{
  "sitemapUrl": "https://www.example.com/sitemap.xml",
  "maxUrls": 50,
  "strategies": ["mobile"],
  "budgets": { "performanceScore": 70, "lcpMs": 2500, "cls": 0.1 }
}

maxUrls limits only the pages taken from the sitemap. Every URL in urls is audited, so count them before you run.

Three ways to start the run:

curl -X POST "https://api.apify.com/v2/acts/datatoolsforall~bulk-lighthouse-pagespeed-audit/runs?maxTotalChargeUsd=1.10" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sitemapUrl":"https://www.example.com/sitemap.xml","maxUrls":50,"strategies":["mobile"]}'
# The response contains data.id (run ID) and data.defaultDatasetId.
curl -H "Authorization: Bearer $APIFY_TOKEN" "https://api.apify.com/v2/actor-runs/<RUN_ID>"   # repeat until status is SUCCEEDED
curl -H "Authorization: Bearer $APIFY_TOKEN" "https://api.apify.com/v2/datasets/<DATASET_ID>/items?format=csv&fields=url,strategy,performanceScore,lcpMs,cls,tbtMs,seoScore,accessibilityScore,passedBudgets,errorCode" > audit.csv

maxTotalChargeUsd is a hard cap: the Actor checks the remaining budget before each audit and stops cleanly when it runs out.

Step 3: read the results

Each row is one URL on one device. The fields you will use most:

Field Meaning
url, finalUrl The URL you gave, and where it ended up after redirects
performanceScore, accessibilityScore, bestPracticesScore, seoScore Lighthouse category scores, 0 to 100
lcpMs, cls, tbtMs, fcpMs, speedIndexMs, ttfbMs Lab metrics: Largest Contentful Paint, Cumulative Layout Shift, Total Blocking Time, First Contentful Paint, Speed Index, time to first byte
opportunities The biggest suggested fixes: [{id, title, savingsMs, savingsBytes}]
passedBudgets, budgetFailures Whether the page met your budgets, and which ones it missed, for example "lcpMs: 4517 > 2500"
errorCode, error, warnings Why an audit failed (not charged), and Lighthouse warnings such as a page that never finished loading

A simple way to work through them:

  1. Sort by performanceScore, lowest first. The bottom ten pages are your list.
  2. Group the bottom pages by template. If every product page is slow, fix the template once.
  3. Count how often each opportunities[].id appears across pages. A fix that shows up on 40 of 50 pages (for example unused JavaScript or oversized images) is usually worth more than any single-page fix.
  4. Filter passedBudgets = false and read budgetFailures for the exact misses. Google describes an LCP of 2,500 ms or less and a CLS of 0.1 or less as “good”.

What this does not tell you

Do it again next month

Save the input as an Apify task and add a schedule, or ask your agent to rerun the same list. Keep the same URLs and device so the numbers are comparable.