Google Search Console and GA4 ship excellent UIs, but the data lives behind APIs that are documented well in pieces and badly as a whole. This eight-chapter guide is the end-to-end path I walked while building Captain Random's telemetry skill — from the OAuth refresh tokens sitting in macOS Keychain through to the daily Telegram digest that surfaces every indexation bucket change. Each chapter cites the canonical Google + IETF + Apple references for the moving parts. The lived-experience layer at the foot of each chapter links the captainrandom.co.uk articles where the pattern was first hit in production.

Chapters8
Published8
Edition2026
Languageen-GB

The chapters.

In chronological order
Chapter 01
Why automate Google Search Console + GA4
Two excellent UIs that get expensive to use when you have more than a handful of properties. The case for treating discovery and analytics as code you can query, alert on, and audit.
9 min read·beginner
Published
Chapter 02
Your Google Cloud project + enabling the APIs
Every Google API call you make over the next six chapters routes through a Google Cloud project. This is the project — what to name it, which APIs to enable, which OAuth client to make, and what to do with the credentials it gives you.
11 min read·beginner
Published
Chapter 03
The OAuth 2.0 flow for installed apps
Four roles, two tokens, one consent screen. The walkthrough of what RFC 6749 actually says is happening when you click 'Allow' on a Google sign-in page, with the parts that matter for our automation marked clearly.
10 min read·intermediate
Published
Chapter 04
Storing OAuth refresh tokens in macOS Keychain
Refresh tokens are long-lived bearer credentials. Storing them in plaintext .env files is a footgun. macOS Keychain gives you encrypted-at-rest storage, per-application access control, and a CLI that any Python script can shell out to.
12 min read·intermediate
Published
Chapter 05
A Python CLI shape for Google APIs
Two scripts grow into eight grow into twenty. The CLI shape that scales — argparse subcommands, a shared auth wrapper that mints credentials once per run, and a single entrypoint your cron can call without remembering which script does which thing.
13 min read·intermediate
Published
Chapter 06
Querying Google Search Console
Three endpoints do most of the work — Sites, URL Inspection, and Search Analytics. This chapter implements indexation bucket pulls and top-query reports against each, with the quota strategy that keeps a daily cron under the rate limits.
12 min read·intermediate
Published
Chapter 07
Querying GA4
The Data API uses a different shape from the GSC API — dimensions and metrics are first-class, sampling is a real concern, and the property identifier is a numeric ID, not a URL. This chapter implements three GA4 queries that cover most of what a daily digest needs.
11 min read·intermediate
Published
Chapter 08
Daily digest cron + Telegram triage
A CLI you have to remember to run is a CLI you forget. This chapter wires everything from chapters 5-7 into a launchd job that runs every morning, computes the diff against yesterday's pull, and DMs you the changes through a Telegram bot you can act on without opening the laptop.
14 min read·advanced
Published