Skip to content

πŸ§ͺ A TypeScript-based tool that runs Google PageSpeed Insights analysis on multiple pages in parallel and generates comparative performance reports

License

Notifications You must be signed in to change notification settings

pferreirafabricio/psi-multiple-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PageSpeed Insights - Multiple Pages

A TypeScript-based tool that runs Google PageSpeed Insights analysis on multiple pages in parallel and generates comparative performance reports.

Overview

This project enables bulk performance analysis by running PageSpeed Insights tests on multiple URLs simultaneously. It aggregates and compares performance metrics, accessibility scores, and optimization data across all analyzed pages, making it easy to identify performance trends and issues across your entire site.

PageSpeed Insights Comparison Report

Features

  • πŸš€ Parallel processing of multiple URLs for faster analysis
  • πŸ“Š Fetches performance data from Google PageSpeed Insights API
  • πŸ“± Supports both mobile and desktop analysis
  • πŸ“ˆ Generates comparative reports in HTML or XLSX format
  • πŸ”„ Compare performance across multiple pages side-by-side
  • πŸ“Š Excel export for easy data analysis and sharing
  • 🎨 Clean, formatted output using Handlebars templates
  • πŸ”§ TypeScript for type safety and better developer experience

Prerequisites

  • Node.js (v14 or higher recommended)
  • Google PageSpeed Insights API key (get one here)

Installation

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Copy the example environment file:
cp .env.example .env
  1. Add your PageSpeed Insights API key to the .env file:
PSI_API_KEY=your_api_key_here

Usage

Edit the src/config/index.ts file to add the pages you want to analyze.

const pageSlugs = [
  'about'
];

Run the tool with HTML output (default):

npm start
# or
npm run start:html

Run the tool with XLSX (Excel) output:

npm run start:xlsx

Or use the format flag directly:

npm start -- --format=html
npm start -- --format=xlsx

The generated report will be saved in the output directory as either report.html or report.xlsx.

Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # Main entry point
β”‚   β”œβ”€β”€ reportTemplate.hbs    # Handlebars template for HTML reports
β”‚   β”œβ”€β”€ helpers/              # Helper functions
β”‚   └── types/                # TypeScript type definitions
β”œβ”€β”€ output/                   # Generated reports directory
β”œβ”€β”€ .env.example              # Environment variables template
└── tsconfig.json             # TypeScript configuration

License

This project is licensed under the MIT License - see the LICENSE file for details.

API Reference

This project uses the Google PageSpeed Insights API.

About

πŸ§ͺ A TypeScript-based tool that runs Google PageSpeed Insights analysis on multiple pages in parallel and generates comparative performance reports

Topics

Resources

License

Stars

Watchers

Forks

Contributors