Autumn/Fall starts now in the Northern Hemisphere. Springtime for the hemispherically challenged. Rendered in Catfood Earth (Windows, Android live wallpaper).
Autumnal Equinox 2017
Email Alerts for new Referers in Google Analytics using Apps Script
It's useful to know when you have a new website referrer. Google Analytics is plagued with spam referral and you want to filter this out of reporting as quickly as possible to stop it from skewing your data. It's also helpful to be able to respond quickly to new referral traffic - maybe leave a comment or promote the new link on social media.
The script below will send you a daily email with links to any new referrers (this is GA3, there is a GA4 version later in this post).
Start a new apps script project in Google Drive and paste in the code. At the top enter the view ID that you want to monitor and the email address that should receive reports.
Choose Advanced Google Services from the Resources menu and switch on the Google Analytics API. Then click the Google API Console link and enable the Google Analytics API there as well.
Finally pick Current project's triggers from the Edit menu and trigger the main function daily at a convenient time.
This script saves known referrers in script properties. For a site with lots of traffic this may run out of space in which case you might need to switch this out and write known referrers to a sheet instead.
For Google Analytics 4 properties use the version of the script below. The setup process is the same, but you need the Google Analytics Data API instead of the Google Analytics API.
Reading and Writing Office 365 Excel from a Console app using the Microsoft.Graph C# Client API
I needed a console app that reads some inputs from an online Excel workbook, does some processing and then writes back the results to a different worksheet. Because I enjoy pain I decided to use the thinly documented new Microsoft.Graph client library. The sample code below assumes that you have a work or education Office 365 subscription.
Paste the code into a new console project and then follow the instructions at the top to add the necessary NuGet packages. You'll also need to register an application at https://portal.azure.com/. You want a Native application and you'll need the Application ID and the redirect URL (just make up some non-routable URL for this). Under Required Permissions for the app you should add read and write files delegated permissions for the Microsoft Graph API.
Hope this saves you a few hours. Comment below if you need a more detailed explanation for any of the above.
Summer Solstice 2017

Summer starts now (or Winter for the Southern Hemisphere). Rendered in Catfood Earth.
CodePlex Shutdown: Shapefile, Orb, StackHash and Blogger2BlogML Migration

Microsoft is finally pulling the plug on CodePlex. I've hosted various projects there over the years and have just finished migrating everything over to GitHub which looks like it just might have a future:
- blogger2blogml - Migrate blogger format blogs to BlogML.
- orb - Controller library for Ambient Orb devices.
- shapefile - parse the ESRI Shapefile format.
- stackhash - full client for downloading and debugging Windows Error Reporting (WER) crash dumps.
Vernal Equinox 2017

Vernal Equinox 2017 happens right now, as rendered in Catfood Earth.
Catfood Weather 2.30

Catfood Weather is a free taskbar based weather forecast app for Windows that includes a seven day forecast and severe weather alerts. It uses National Weather Service data and works for any US location (by ZIP code or latitude and longitude).
This update fixes a problem calling the National Weather Service API, so please install 2.30 if you're using a previous version of Catfood Weather. To get alerts for new releases follow the RSS Feed or sign up to the ITHCWY Newsletter.
Get an email if your site stops being mobile friendly (no longer available)
Google axed this tool today, so the script won't work any more. If you're looking for a replacement check out my Core Web Vitals script.

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.




