Free workshop
SEO in 90 minutes: audit your own website. Seats are limited.SEO in 90 minutes: audit your own site.
00d00h00m00s

Automate your weekly SEO report with GA4, Search Console and a language model

Weekly reports eat hours and still miss things. Here is a simple pipeline: pull the data with two APIs, work out the numbers in code, then let a language model explain them in plain words.
Sooraj PFull-stack developer and SEO strategist
5 min read
0 views
Automate your weekly SEO report with GA4, Search Console and a language model
Data charts and a search analytics panel flowing through gears into an automated report with a calendar and email

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.

01

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. 1

    Pull

    Call the GA4 Data API and the Search Console API for last week and the week before.

  2. 2

    Clean

    Put both results in tidy tables. Join them only where it makes sense.

  3. 3

    Calculate

    Work out changes, shares and top movers in code, not in the model.

  4. 4

    Explain

    Send the finished numbers to a language model and ask for a short plain summary.

  5. 5

    Deliver

    Send the report by email or chat on a schedule.

02

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.

Manual report versus automated report
ProblemManual reportAutomated report
TimingDone when someone has timeReady every Monday at the same hour
LayoutChanges with the authorFixed, so week-to-week gaps stand out
AccuracyCopy and paste errorsThe same query every time
CostAbout an hour per siteMinutes to review, after setup
03

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

ga4-request.json
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

04

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.

gsc-request.json
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}
Request fields that matter most
FieldWhat Google saysMy advice
rowLimitValid range is 1 to 25,000. Default is 1,000.Always set it to 25,000
startRowZero-based offset. Past the end it returns zero rows.Loop until a page returns no rows
dataStateFinal data only, unless you ask for all, which includes fresh data.Use final for weekly reports
typeWeb is the default. Image, video, news and others are separate.Run web first, add others later
05

Step 3: Respect the limits

APIs have quotas. A weekly script rarely hits them, but a loop with a bug can.

Quotas from the official pages
APILimitSource
GA4 Data API200,000 core tokens per property per dayQuotas page
GA4 Data API40,000 core tokens per property per hourQuotas page
GA4 Data API10 concurrent requests per propertyQuotas page
Search Console1,200 queries per minute per site, for Search AnalyticsUsage 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

06

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. 1

    Totals

    Sum sessions and clicks for each week.

  2. 2

    Change

    Work out the difference and the percentage for each week-on-week pair.

  3. 3

    Top movers

    List the five pages that gained and the five that lost the most clicks.

  4. 4

    Flags

    Mark any change above a set size, such as 20 percent on a page with real traffic.

  5. 5

    Context

    Add the last four weeks as a baseline, so one odd week does not look like a trend.

07

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. 1

    Role

    Tell it to act as an analyst writing for a busy owner.

  2. 2

    Data

    Paste the computed table. Say these are the only facts it may use.

  3. 3

    Rules

    No new numbers. No guesses about cause. Mark anything uncertain as a question to check.

  4. 4

    Format

    Ask for three parts: what changed, what might explain it, what to check next.

  5. 5

    Length

    Cap it at 150 words, in short sentences.

08

A report layout that works

Keep the layout the same every week. Readers learn where to look.

Weekly report sections
SectionContentsSource
HeadlineThree lines: traffic, clicks and one thing to watchCalculated, then written by the model
TrafficSessions and users, this week against last weekGA4
SearchClicks, impressions, CTR and positionSearch Console
MoversTop five gainers and losers by clicksSearch Console
ActionsUp to three tasks for next weekYou, from the data
09

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. 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. 2

    Send to one place

    Email or a team channel. One place is easier to trust than three.

  3. 3

    Keep every report

    Save each run as a file. After a few months, you can chart trends.

  4. 4

    Alert on failure

    If an API call fails, send a short error message. Silence is the worst result.

10

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.

11

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.

12 · The short version

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.


Join the conversation

Say hello · I reply personally

Tell me how I can help

1 · Details2 · Done

Message received

Thanks, there. I read every message myself and will reply to your inbox within one business day.