Automate a Weekly SEO Report With Claude Code (GA4 + Search Console + Bing)
In short: A scheduled script pulls Google Analytics, Search Console and Bing every Monday, writes a one-page report, and checks your key pages are live. You then open Claude Code, read the report, and have Claude draft edits for the three weakest pages. Nothing publishes without your approval. Setup is one Python file and one scheduled task.
Most "AI SEO automation" posts show a prompt.
A prompt is not a system.
A system runs when you forget, leaves a log when it fails, and stops before it touches your live site. This post shows the one I use on this website.
The loop in six steps
- Pull: Search Console, GA4 and Bing, latest 28 days against the 28 before.
- Flag: pages that lost clicks or slipped three or more positions.
- Find striking distance: queries at positions 8 to 20 with real impressions.
- Check: open the key pages and confirm status 200, one H1, a self-referencing canonical and JSON-LD.
- Log: one line per run, one row per week in a spreadsheet, so a failed run can resume.
- Draft: in a Monday session, Claude reads the report and drafts edits. You say "deploy" or you do not.
Why a scheduler, not a Claude schedule
A cloud routine cannot read key files on your own computer. A /loop only runs while a session is open. So the data pull runs from Windows Task Scheduler on the machine that holds the credentials, and Claude does the thinking when you open a session. Pulling data is mechanical. Deciding what to change is judgment.
What the report looks like
Here is real output from 6 November 2026 (striking-distance section):
- Our SaaS consultant article: "saas seo consulting" (377 impressions, position 9); "b2b saas seo consultant" (264, position 8)
- Our AI citation sources article: "top chatgpt citation domains" (140 impressions, position 9)
These are the queries where a better title, a tighter intro or one extra section can move a page onto page one. Claude drafts those edits, and I approve them.
Set it up
1. Credentials. A service account with Viewer on one GA4 property and "Full" or "Restricted" user on the Search Console property. Add Bing's API key from Bing Webmaster Tools. See how to connect GA4 to Claude and Search Console to Claude.
2. The script. Download the free Weekly SEO Loop Kit: one Python file, a config file and a README. It has a function per step. Each step writes a "done" marker, so if Bing fails on Monday, the rerun skips the finished steps. Keep the Singapore-style bot filter: subtract Direct sessions with almost no engagement before you read GA4.
3. The schedule. In PowerShell:
$a = New-ScheduledTaskAction -Execute 'python' -Argument 'weekly_seo_loop.py --config config.json' -WorkingDirectory 'C:\seo\reports'
$t = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 8:30AM
$s = New-ScheduledTaskSettingsSet -StartWhenAvailable
Register-ScheduledTask -TaskName 'Weekly SEO Loop' -Action $a -Trigger $t -Settings $s
StartWhenAvailable means a missed Monday runs when the computer wakes.
4. The Monday session. Open Claude Code and say: "Read this week's report. Draft edits for the three pages that lost the most clicks. Drafts only."
What each part of the report tells you
- The metrics table compares the latest 28 days with the 28 before. Look at clicks, impressions and position together: impressions flat with position worse means demand is steady and rankings are slipping.
- Pages that lost clicks lists pages that dropped by two or more clicks, or slipped three or more positions with real impressions. These are your rewrite candidates.
- Striking distance lists queries at positions 8 to 20 with at least 50 impressions, grouped by page. These are your quickest wins: a page already near page one needs a sharper title or one more section, not a rebuild.
- Live page check opens your key pages and confirms status 200, one H1, a self-referencing canonical and JSON-LD. It catches a broken release before Google does.
- GA4 key events are listed so you can spot spam. Form submits from countries you never serve are not leads.
How to read it in ten minutes
- Read the metrics table. Is the problem rankings (position worse), demand (impressions down) or snippets (impressions flat, CTR down)?
- Take the top three pages in the "lost clicks" table. Open each and ask: did the search intent change, did a competitor's page change, or did my page lose freshness?
- Take the two striking-distance pages with the most impressions. Compare their top query to the page's title and first paragraph. If they do not match, that is your edit.
- Check the live page table for any CHECK or NO. Fix those before anything else.
- Hand the list to Claude with the Monday prompt, and review the drafts.
Troubleshooting
| What you see | Cause | Fix |
|---|---|---|
pull: FAILED 403 on Search Console |
The service account is not a user on the property | Add its email in Search Console, Settings, Users and permissions |
pull: FAILED 403 on GA4 |
The service account is not Viewer on the property, or the Data API is off | Add Viewer in GA4 Admin, enable the Data API |
| Report has no rows for pages | A new site or too little data | Wait for 28 days of data |
| Live check shows 403 or status 0 | Your host's bot protection challenged the request | Increase the pause between requests, or check fewer URLs |
| The scheduled task did not run | The computer was off or asleep at the time | The task is set to run when available; check loop.log |
What to add next
- Bing AI Performance: open it by hand once a week (it is not in the API) and write the cited-page count into your log.
- Your own money pages: put every service and pricing page in
key_pages, so a broken release shows up on Monday. - A monthly rollup: the log file is a CSV, so a simple chart of clicks and position by week shows whether the edits are working.
What it costs
The Search Console, GA4 and Bing APIs are free within their quotas. The script is free. You only spend Claude usage in the Monday session.
Rules that keep it safe
- Read-only credentials. The script cannot edit your site.
- Paced requests, one per second, so it does not trip your host's bot protection.
- Drafts go to a folder that never deploys.
- One human approval before anything goes live.
What it does not do
It does not write and publish pages for you. It does not replace judgment about intent. Bing's AI Performance report is not in the API, so I still open it by hand once a week.
Kulbhushan's Take
The value is not the report. It is that Monday morning starts with three named pages and the exact queries each one should win, instead of an hour of tab hopping. Automating the pull is what makes me do the edit.
Frequently Asked Questions
Can Claude run this on a schedule by itself?
A cloud routine cannot reach files on your computer, and /loop needs an open session. A local scheduled job plus a Monday session works for both.
Is it free?
The APIs are free within quotas. Claude usage only happens in your Monday session.
Will it publish changes automatically?
No. It drafts; you approve.
How long does a run take?
About two minutes without the workbook rebuild.
Do I need Bing?
It is optional, but Bing's index feeds ChatGPT-style search, and it showed up for this site before Google did.
Leave a Comment
Your email address will not be published. Comments are moderated before appearing.