On this page

Chapter 1 of 8. This is the why-bother chapter. If you already know you want to automate GSC and GA4 and just want to start building, skip to Chapter 2 — Your Google Cloud project + enabling the APIs.

The cost of using the UIs

Both Google Search Console and Google Analytics 4 ship excellent web interfaces. Anyone running one or two sites should use them as the primary surface — there is no advantage to building a worse copy.

The trouble starts the moment you run more than a couple of properties, or the moment you want to ask a question the UI was not built to answer. Three specific costs accumulate.

Time. The GSC Index Coverage report gives you a state snapshot of every URL on the property, broken into buckets that match Google's documented crawling and indexing pipeline: Indexed, Crawled, currently not indexed, Discovered, currently not indexed, Duplicate, URL is unknown to Google, and a handful more (per Google's Index Coverage help article). To see them, you click into the report, wait for the chart to load, click into a bucket, wait again, scroll, copy URLs out one at a time. A weekly audit across three properties takes the better part of an hour. The same data through the API takes a few seconds and lands in a script.

Memory. The UI shows you now. It does not show you what changed since last week. If three URLs slipped from Indexed into Crawled, currently not indexed on Tuesday, you find out only by remembering Tuesday's numbers and noticing the drop today. Nobody remembers Tuesday's numbers. Automation keeps a rolling history, diffs against it, and tells you the moment something moves.

Compound questions. GA4's UI is built around predefined reports plus a custom-exploration tool. The custom-exploration tool is genuinely useful but caps at sampling thresholds the Data API documents explicitly. Anything that joins GA4 data to GSC data — which queries are landing on the pages with the highest scroll depth? — needs both APIs talking to the same code at the same time. The UI cannot answer that on its own.

What you can do with the APIs that the UI cannot

A short and concrete list, drawn from things I have actually built rather than hypotheticals.

  • Daily indexation digest. Pull the GSC URL Inspection results for every URL on the sitemap, group by bucket, diff against yesterday, push the diff to Telegram at 19:00. Catches deindexation the same day it happens, which on average is several days before you would notice in the UI.
  • Cannibalisation detection. Pull the GSC search queries report for the last 28 days, group by query, count how many distinct URLs each query is associated with. Any query landing on two or more URLs is a cannibalisation candidate — Google is unsure which URL to rank and the impressions split. I caught eight pairs of cannibalising URLs in a single sweep this way.
  • Internal-traffic filter. Pull GA4 sessions filtered by a custom dimension you control — for example, a session_role event parameter you set client-side. Plot internal vs external sessions to see whether your daily build-and-check workflow is contaminating your real-traffic numbers.
  • Pre-deploy indexation snapshot. Pull the GSC indexed-URL count before and after a deploy that changed routing. If the count drops, the routing change broke something Google was previously indexing.

Every one of these is a small Python script driven by a cron. None of them require ongoing UI work after the script is wired. All of them produce signals the UI surfaces eventually but slowly.

The acceptance threshold

You should probably automate when at least one of these is true:

  • You manage more than three properties and use the GSC UI weekly across all of them.
  • You write or review more than one article a week and care about whether each one is being indexed.
  • You have made at least two technical changes (canonicals, redirects, sitemaps, robots) in the last six months and want to know whether each change moved the indexation numbers.
  • You suspect cannibalisation but have not measured it.

If none of those is true, the UI is enough. Come back to this guide when one becomes true.

What the next chapters cover

The remaining seven chapters in this guide build a small Python CLI that does all of the above. Chronologically:

  • Chapter 2 — your Google Cloud project + enabling the APIs. Foundation.
  • Chapter 3 — the OAuth 2.0 flow for installed apps. What is actually happening when you click "Allow".
  • Chapter 4 — storing the refresh token in macOS Keychain rather than a .env file.
  • Chapter 5 — a Python CLI shape that scales beyond two scripts.
  • Chapter 6 — querying GSC: indexation, queries, performance.
  • Chapter 7 — querying GA4: events, sessions, dimensions, sampling.
  • Chapter 8 — putting it together as a daily digest cron + Telegram triage UI.

You can skip directly to whichever chapter answers a question you already have. Each chapter declares its prerequisites.

// EXERCISE

Audit your own properties against the threshold

Apply this chapter's acceptance threshold to your own situation before writing any code. Inventory every GSC and GA4 property you can access, time one full manual pass of the Index Coverage report across all of them, and rank the four automation ideas from this chapter by expected payback for your sites.

Expected behaviour
  • A written inventory of every property you manage, with how often you currently check each one in the UI
  • A measured time cost in minutes for one manual Index Coverage pass across all properties
  • At least one compound question you want answered that needs GSC and GA4 data joined in the same code
  • A ranked shortlist of the four automation ideas from this chapter, ordered by payback for your own sites

PROVE IT Present the inventory and the shortlist, and defend your top pick using the measured minutes per manual pass rather than a guess.

// CHECKPOINT — WHY AUTOMATE
multiple choice · auto-checked

What is the memory cost of the GSC UI that automation fixes?

exact answer · auto-checked

The cannibalisation detection sweep pulls the GSC search queries report over how many days?

open · self-checked

According to this chapter, when should you NOT automate, and what should you do instead?

Show answer

When none of the acceptance criteria hold: you manage three properties or fewer, you publish less than an article a week, you have made no recent technical changes you need to measure, and you have no cannibalisation suspicion. In that case the UI is enough, and the chapter says to come back to the guide when one of the criteria becomes true.

↺ re-read: “The acceptance threshold

Lived experience

Sources

Back to guide overview