# SEO and Google Search Console

**URL:** <https://forum.kirupa.com/t/seo-and-google-search-console/684362>\
**Category:** web dev\
**Created:** [December 4, 2026, 7:14am UTC](https://forum.kirupa.com/t/seo-and-google-search-console/684362 "2026-12-04T07:14:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 4, 2026, 7:14am UTC](https://forum.kirupa.com/t/seo-and-google-search-console/684362/1 "2026-12-04T07:14:44Z")

</div>

Our sourdough page wasn’t showing up on Google, and we had no idea why. Our new tutorial covers basic SEO, Google Search Console, and how to give an AI agent read-only access with a service account:

> **[How to Use Google Search Console (and Connect an Agent) | KIRUPA](https://www.kirupa.com/marketing_and_growth/seo_and_search_console.htm)**
>
> Get basic SEO right, use Google Search Console to see which searches find your pages and why some aren't indexed, then give your AI agent read-only access.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 4, 2026, 3:46pm UTC](https://forum.kirupa.com/t/seo-and-google-search-console/684362/2 "2026-12-04T15:46:33Z")

</div>

Here’s the companion code for the article. It’s roughly what an agent writes when you hand it the prompt from the article: a short Python script that signs in with a service account key, asks for read-only access, and pulls the last 28 days of Search Console data by page and query.

First, install Google’s client libraries:

```bash
pip install google-auth google-api-python-client

```

Then swap in your own key file and property, and run it:

```python
import os
from datetime import date, timedelta
from google.oauth2 import service_account
from googleapiclient.discovery import build

KEY_FILE = os.path.expanduser("~/secrets/search-console-key.json")
PROPERTY = "sc-domain:example.com" # or "https://example.com/" for a URL-prefix property

creds = service_account.Credentials.from_service_account_file(
    KEY_FILE, scopes=["https://www.googleapis.com/auth/webmasters.readonly"])
search_console = build("searchconsole", "v1", credentials=creds)

end = date.today() - timedelta(days=3) # the newest data takes a few days to settle
start = end - timedelta(days=27) # 28 days in all
report = search_console.searchanalytics().query(
    siteUrl=PROPERTY,
    body={"startDate": start.isoformat(), "endDate": end.isoformat(),
          "dimensions": ["page", "query"], "rowLimit": 25000}).execute()

for row in report.get("rows", []):
    page, query = row["keys"]
    print(page, query, row["clicks"], row["impressions"], round(row["position"], 1))

```

Rows come back sorted by clicks, so it asks for 25,000 rows (the most one request allows) to make sure the searches with lots of impressions and few clicks make the cut. The service account’s email needs to be a user on the property in Search Console, or Google answers with a 403.
