Get an email if your site stops being mobile friendly
Google just released an API for the mobile friendly test and so I've whipped up a script to send an alert if a web page violates their guidelines. This will run the test as often as you like and send you an email if it detects a problem. Alternatively if you're not mobile friendly it will keep emailing you until you fix any problems which might be a good motivational tool.
First start a new apps script project in drive and paste in the code below:
There are three variables you need to set, urlToMonitor is the full URL of the page to test, alertEmail is your email address (or whoever needs to be pestered) and runTestKey is the API key for the service. To get this go to the Google API Console, click Enable API, search for 'Google Search Console URL Testing Tools API' and click enable. Then click the Credentials option and generate a browser key.
Once you've configured the script choose 'Current project's triggers' from the Resources menu in apps script and set up a schedule for the mobileFriendlyMonitor() function.
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
- Automate Google PageSpeed Insights with Apps Script
- Using the Azure Monitor REST API from Google Apps Script
Add Comment
All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.