Here's a quick script to automatically monitor your Google PageSpeed Insights desktop and mobile scores for a web page:
Note that this currently just logs the overall score. There are a bunch of other values returned (like number and types of resources on the page) that you could choose to monitor as well. It would also be easy to extend this to monitor more URLs, or to send you an email if the score drops below a threshold.
Updated May 5, 2019 to use version 5 of the PageSpeed API.
More Google Apps Script Projects
- Export Google Fit Daily Steps, Weight and Distance to a Google Sheet
- How to backup Google Photos to Google Drive automatically after July 2019 with Apps Script
- Get an email when your security camera sees something new (Apps Script + Cloud Vision)
- Email Alerts for new Referers in Google Analytics using Apps Script
- Get an email if your site stops being mobile friendly
- Using the Azure Monitor REST API from Google Apps Script