Skip to content

Robbieakoto/Web-Performance-Scanner

Repository files navigation

🇬🇭 Ghana Web Performance Scanner

A data-driven web tool that runs Google PageSpeed Insights audits on 20 major Ghanaian websites across news, banking, e-commerce, and government sectors. Results are visualised in a dark-themed dashboard with sortable tables, interactive charts, and concrete performance recommendations.

Live site: https://web-performance-scanner.web.app


What It Does

  • Audits 20 Ghanaian websites using the PageSpeed Insights API v5 (Lighthouse)
  • Measures Core Web Vitals — LCP, CLS, FCP, TTFB, TBT
  • Tracks 10 common audit failures per site (image optimisation, render-blocking scripts, CDN usage, etc.)
  • Displays results in a filterable, sortable table by sector
  • Visualises patterns with 4 interactive Chart.js charts
  • Surfaces 8 ranked, actionable recommendations for Ghanaian web teams

Tech Stack

Layer Technology
Frontend Vanilla JS, HTML5, CSS3
Charts Chart.js 4
API Google PageSpeed Insights API v5
Hosting Firebase Hosting
Secrets dotenv (.env file, never committed)

Project Structure

├── public/
│   ├── index.html          # Main page
│   ├── css/styles.css      # Dark theme, Ghana flag accents
│   ├── js/
│   │   ├── app.js          # Entry point & event wiring
│   │   ├── data.js         # Data loading & aggregation helpers
│   │   ├── renderer.js     # DOM rendering (table, cards, recommendations)
│   │   └── charts.js       # Chart.js chart builders
│   └── data/results.json   # PSI audit output (generated by run_audit.js)
├── scripts/
│   ├── run_audit.js        # Calls PSI API for all 20 sites → results.json
│   └── setup.js            # Writes Firebase project ID from .env → .firebaserc
├── .env.example            # Environment variable template (safe to commit)
├── .env                    # Your real keys (git-ignored, never committed)
├── firebase.json           # Firebase Hosting config
└── .firebaserc             # Firebase project alias

Getting Started

Prerequisites

1. Clone & Install

git clone https://github.com/your-username/ghana-web-perf-scanner.git
cd ghana-web-perf-scanner
npm install

2. Configure Environment

cp .env.example .env

Open .env and fill in your values:

PSI_API_KEY=your_pagespeed_insights_api_key
FIREBASE_PROJECT_ID=your_firebase_project_id

3. Run Locally

npm run dev
# → http://localhost:3000

Running a Live Audit

The app ships with pre-run data in public/data/results.json. To refresh it with real API data:

npm run audit

This calls the PSI API for all 20 sites (~1 minute), then overwrites results.json. All 10 Lighthouse audit flags, Core Web Vitals, and category scores are captured per site.


Deploying to Firebase

npm run setup    # Injects your Firebase project ID from .env → .firebaserc
npm run login    # Authenticates with Firebase (browser pop-up, one-time)
npm run deploy   # Deploys public/ to Firebase Hosting

Or run audit + deploy in one command:

npm run audit:deploy

Sites Audited

Sector Sites Avg Score
📰 News MyJoyOnline, GhanaWeb, Graphic Online, Citinewsroom, Pulse Ghana 40
🏦 Banking GCB Bank, Absa Ghana, Stanbic Ghana, Ecobank Ghana 35
📞 Telecom MTN Ghana 36
🛒 E-Commerce Jumia Ghana, Tonaton, Melcom Ghana, Paystack 69
💳 Fintech Hubtel 47
🏛️ Government / Education Ghana.gov.gh, GRA Ghana, University of Ghana, KNUST, NHIS Ghana 46

All audits are run in mobile mode — the most relevant simulation for Ghana, where ~80% of internet usage is mobile.


Key Findings (April 2026)

  • Average performance score: 46/100 — well below Google's recommended threshold of 90
  • Only 3/20 sites pass Core Web Vitals on mobile (Citinewsroom, Tonaton, Paystack)
  • 13 of 20 sites score below 50 — classified as "Poor" by Lighthouse
  • Average LCP: 20.7 seconds — Google's "Good" threshold is 2.5s
  • Unused JavaScript is the #1 issue, affecting 17/20 sites
  • Unused CSS affects 16/20 sites, large network payloads affect 14/20
  • E-Commerce leads all sectors (avg score: 69); Banking is slowest (avg: 35)
  • Top 3 performers: Tonaton (99), Citinewsroom (97), Paystack (97)
  • Bottom 3: NHIS Ghana (17), GhanaWeb (11), Melcom Ghana (21)
  • 4 sites (MyJoyOnline, GhanaWeb, Graphic Online, MTN Ghana) timed out during the live API scan — scores estimated from Lighthouse lab data patterns

License

MIT — built for the Ghana Developer Ecosystem.

About

A simple web tool that runs PageSpeed Insights audits on 20 Ghanaian websites

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors