Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

Find your real 24-hour click peak with the Search Console API (hourly data)

The Search Console UI shows a "last 24 hours" view, but it moves every hour. If you only look at it twice a day you'll miss your real peak. Last week our site hit 307 clicks on its best calendar day, but the rolling 24-h

The Search Console UI shows a "last 24 hours" view, but it moves every hour. If you only look at it twice a day you'll miss your real peak. Last week our site hit 307 clicks on its best calendar day, but the rolling 24-hour peak was 347 — and I only found it through the API.

Here's the small script.

1. Request hourly data

The Search Analytics API accepts dataState: "hourly_all" together with the hour dimension. It returns the last few days hour by hour (timestamps are in Pacific Time).

from google.oauth2 import service_account
from googleapiclient.discovery import build

creds = service_account.Credentials.from_service_account_file(
    "service-account.json",
    scopes=["https://www.googleapis.com/auth/webmasters.readonly"])
gsc = build("searchconsole", "v1", credentials=creds)

rows = gsc.searchanalytics().query(
    siteUrl="https://example.com/",
    body={
        "startDate": "2026-11-25",
        "endDate": "2026-11-29",
        "dimensions": ["hour"],
        "dataState": "hourly_all",
        "type": "web",
        "rowLimit": 500,
    },
).execute().get("rows", [])

Add the service account as a user of the property (restricted is enough).

2. Slide a 24-hour window

best = (0, None)
for i in range(23, len(rows)):
    window = rows[i - 23:i + 1]
    clicks = sum(r["clicks"] for r in window)
    if clicks > best[0]:
        best = (clicks, rows[i]["keys"][0])

print(f"Peak: {best[0]} clicks in the 24 h ending {best[1]}")

keys[0] is an ISO timestamp like 2026-11-29T02:00:00-08:00. Convert it to your time zone before you report it.

3. Check concentration, not just volume

A spike from one lucky URL and a spike spread across many pages are different stories. Same API, page dimension, daily data:

pages = gsc.searchanalytics().query(
    siteUrl="https://example.com/",
    body={"startDate": "2026-11-28", "endDate": "2026-11-29",
          "dimensions": ["page"], "dataState": "all", "rowLimit": 25000},
).execute().get("rows", [])

total = sum(r["clicks"] for r in pages)
top = max(r["clicks"] for r in pages)
with_clicks = sum(1 for r in pages if r["clicks"])
print(f"{with_clicks} pages with clicks, top page = {top / total:.0%}")

In our case: 61 pages with clicks, the top one only 18%. That told me the growth came from the method, not from one page.

Gotchas

  • Hourly data only covers the last ~10 days. Save it if you want history.
  • dataState: "all" includes fresh, not-yet-final data; numbers can move a little for a couple of days.
  • The 24-hour UI view and your sum can differ by a few clicks because of privacy filtering.

I run all this from a scheduled script that posts a daily report to Telegram, so the peak never slips by.

The case behind these numbers (Spanish, with screenshots): https://mapalocal.es/casos-de-exito/black-friday-contenido-local-307-clics/

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.