Most weekly SEO reports are built by hand. Someone exports a sheet, copies numbers and writes a few lines. It takes an hour and it is often late. A script can do the boring part. This guide shows how to pull data from Google Analytics 4 and Search Console, check the API limits and add a language model for the written summary. It also shows where a model should not be trusted, which is the part most tutorials skip.
What you will build
The goal is one short report that lands in your inbox every Monday. It has the same layout each week, so changes are easy to spot.
The pipeline has five small stages. Each one does one job and can be tested alone.
- 1
Pull
Call the GA4 Data API and the Search Console API for last week and the week before.
- 2
Clean
Put both results in tidy tables. Join them only where it makes sense.
- 3
Calculate
Work out changes, shares and top movers in code, not in the model.
- 4
Explain
Send the finished numbers to a language model and ask for a short plain summary.
- 5
Deliver
Send the report by email or chat on a schedule.
Why manual reports fail
A manual report breaks in three ways. It is late, it changes shape from week to week and it hides small trends.
| Problem | Manual report | Automated report |
|---|---|---|
| Timing | Done when someone has time | Ready every Monday at the same hour |
| Layout | Changes with the author | Fixed, so week-to-week gaps stand out |
| Accuracy | Copy and paste errors | The same query every time |
| Cost | About an hour per site | Minutes to review, after setup |
Step 1: Pull data from GA4
The GA4 Data API has a method called runReport. You send it dimensions, metrics and date ranges. It returns a table.1
A request needs a valid date range, at least one dimension and at least one metric.2 Names are lowerCamelCase, such as sessions, activeUsers and totalRevenue.2
Relative dates such as 7daysAgo and yesterday work. You can also send more than one date range in one request, which makes week-on-week checks easy.2
1{2 "dateRanges": [3 { "startDate": "7daysAgo", "endDate": "yesterday" },4 { "startDate": "14daysAgo", "endDate": "8daysAgo" }5 ],6 "dimensions": [{ "name": "date" }],7 "metrics": [{ "name": "sessions" }, { "name": "activeUsers" }]8}Two details save time. If you ask for many rows, the default limit is 10,000. A single request can return at most 250,000 rows, and you can page with offset.1
Step 2: Pull data from Search Console
Search Console has its own API. The query method returns clicks, impressions, CTR and position for the dimensions you ask for.4
Dates must be in Pacific Time, and the range is inclusive.4 This matters when your server runs in another time zone.
1{2 "startDate": "2026-10-05",3 "endDate": "2026-10-11",4 "dimensions": ["page", "query"],5 "type": "web",6 "dataState": "final",7 "rowLimit": 25000,8 "startRow": 09}| Field | What Google says | My advice |
|---|---|---|
| rowLimit | Valid range is 1 to 25,000. Default is 1,000. | Always set it to 25,000 |
| startRow | Zero-based offset. Past the end it returns zero rows. | Loop until a page returns no rows |
| dataState | Final data only, unless you ask for all, which includes fresh data. | Use final for weekly reports |
| type | Web is the default. Image, video, news and others are separate. | Run web first, add others later |
Step 3: Respect the limits
APIs have quotas. A weekly script rarely hits them, but a loop with a bug can.
| API | Limit | Source |
|---|---|---|
| GA4 Data API | 200,000 core tokens per property per day | Quotas page |
| GA4 Data API | 40,000 core tokens per property per hour | Quotas page |
| GA4 Data API | 10 concurrent requests per property | Quotas page |
| Search Console | 1,200 queries per minute per site, for Search Analytics | Usage limits page |
Most GA4 requests cost 10 tokens or fewer. Complex ones cost more. Extra rows, dimensions, filters and long date ranges all raise the cost.3
When a bucket runs out, the API returns 429 RESOURCE_EXHAUSTED.3 Your script should wait and retry later, not hammer the server.5
Step 4: Calculate before you ask a model
This is the step that makes a report trustworthy. Work out every number in code first.
- 1
Totals
Sum sessions and clicks for each week.
- 2
Change
Work out the difference and the percentage for each week-on-week pair.
- 3
Top movers
List the five pages that gained and the five that lost the most clicks.
- 4
Flags
Mark any change above a set size, such as 20 percent on a page with real traffic.
- 5
Context
Add the last four weeks as a baseline, so one odd week does not look like a trend.
Step 5: Let the model write, not calculate
A language model is good at turning a table into plain sentences. It is not a calculator. It can also state a wrong figure with great confidence.
So give it the finished numbers and tight rules. Here is the prompt shape I use.
- 1
Role
Tell it to act as an analyst writing for a busy owner.
- 2
Data
Paste the computed table. Say these are the only facts it may use.
- 3
Rules
No new numbers. No guesses about cause. Mark anything uncertain as a question to check.
- 4
Format
Ask for three parts: what changed, what might explain it, what to check next.
- 5
Length
Cap it at 150 words, in short sentences.
A report layout that works
Keep the layout the same every week. Readers learn where to look.
| Section | Contents | Source |
|---|---|---|
| Headline | Three lines: traffic, clicks and one thing to watch | Calculated, then written by the model |
| Traffic | Sessions and users, this week against last week | GA4 |
| Search | Clicks, impressions, CTR and position | Search Console |
| Movers | Top five gainers and losers by clicks | Search Console |
| Actions | Up to three tasks for next week | You, from the data |
Step 6: Schedule and deliver
Run the script on a schedule, such as a weekly job on a small server or a scheduled workflow.
- 1
Run on a fixed day
Pick Monday morning and report on the full week before. Use final data only, so numbers do not shift later.
- 2
Send to one place
Email or a team channel. One place is easier to trust than three.
- 3
Keep every report
Save each run as a file. After a few months, you can chart trends.
- 4
Alert on failure
If an API call fails, send a short error message. Silence is the worst result.
How I would run it
I would start small. One script, two API calls and a template. No dashboard, no database.
I also keep a human step. The script drafts. I read it for five minutes, fix the wording and add the one thing the data cannot say, such as a campaign or a site change.
Automation saves the hour of copying. It does not save the thinking. That part stays with a person.
Common mistakes
Letting the model calculate changes and percentages.
Forgetting that Search Console dates use Pacific Time.
Using fresh data in a weekly report, then seeing the numbers shift.
Flagging big percentage swings on pages with almost no traffic.
Sending a report nobody reads, with no action at the end.
Quick questions
Do I need to code to do this?
Some setup needs code. A no-code tool or a spreadsheet add-on can pull the same data, but the steps and checks above still apply.
Which model should I use?
Any model that follows instructions well. The rules in your prompt matter more than the brand.
Can I report on more than one site?
Yes. Loop over a list of properties. Watch the GA4 quotas, which apply per property.
Is it safe to send client data to a model?
Check your agreement and your privacy rules first. Send aggregated numbers, not personal data.
Key takeaways
Pull data with the GA4 and Search Console APIs, and keep the layout fixed.
Do all maths in code. Use the model only for plain-language summaries.
Respect limits: GA4 core tokens and Search Console query rates.
Check every number in the summary against your table.
End each report with a clear action.
