Building an SEO Automation Pipeline with Google Search Console API
USD/JPY分散は、為替急変局面で一方通貨の過大シェアを防ぎ、月次の再バランスと上限規則で感情的な一括投資を抑える実践設計です。
Building an SEO Automation Pipeline with Google Search Console API
The GSC API is the most useful free SEO data source available. Instead of checking it manually every day, here's how to automatically collect and analyze the data through a pipeline.
Prerequisites
| Item | Value |
|---|---|
| Efficiency Improvement | 100% |
- 1Google Cloud Console project
- 2Create a Service Account + download the JSON key
- 3Enable the Google Search Console API
- 4Add the service account email as a property user in GSC
Step 1: Service Account Authentication
import { SignJWT } from "jose"
async function getAccessToken(saJson: string) {
const key = JSON.parse(saJson)
const now = Math.floor(Date.now() / 1000)
const jwt = await new SignJWT({
scope: "https://www.googleapis.com/auth/webmasters.readonly",
})
.setProtectedHeader({ alg: "RS256", typ: "JWT" })
.setIssuer(key.client_email)
.setAudience("https://oauth2.googleapis.com/token")
.setIssuedAt(now)
.setExpirationTime(now + 3600)
.sign(await importPrivateKey(key.private_key))
const res = await fetch("https://oauth2.googleapis.com/token", {
method: "POST",
body: new URLSearchParams({
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: jwt,
}),
})
const { access_token } = await res.json()
return access_token
}Step 2: Querying Performance Data
async function queryGSC(token: string, siteUrl: string) {
const url = `https://searchconsole.googleapis.com/webmasters/v3/sites/${encodeURIComponent(siteUrl)}/searchAnalytics/query`
const body = {
startDate: "2026-03-25",
endDate: "2026-04-21",
dimensions: ["query", "page"],
rowLimit: 1000,
}
const res = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${token}` },
body: JSON.stringify(body),
})
return res.json()
}Step 3: Automated Pipeline (CF Workers + D1)
// Runs every day at 3 AM
export default {
async scheduled(event: ScheduledEvent, env: Env) {
const token = await getAccessToken(env.GSC_SA_JSON)
const data = await queryGSC(token, env.GSC_SITE_URL)
// Save to D1
for (const row of data.rows) {
await env.DB.prepare(
"INSERT INTO gsc_daily (date, query, page, clicks, impressions, ctr, position) VALUES (?, ?, ?, ?, ?, ?, ?)"
).bind(new Date().toISOString().slice(0, 10), row.keys[0], row.keys[1], row.clicks, row.impressions, row.ctr, row.position).run()
}
},
}wrangler.toml:
[triggers]
crons = ["0 18 * * *"] # Daily at KST 03:00Step 4: Notification Automation
// detection of keywords with sharp ranking drops
const sql = `
SELECT query, SUM(clicks) as recent_clicks,
(SELECT SUM(clicks) FROM gsc_daily WHERE query=g.query AND date BETWEEN DATE(?, '-14 days') AND DATE(?, '-8 days')) as prev_clicks
FROM gsc_daily g
WHERE date >= DATE(?, '-7 days')
GROUP BY query
HAVING prev_clicks > 10 AND recent_clicks < prev_clicks * 0.5
`
const dropped = await env.DB.prepare(sql).bind(today, today, today).all()
if (dropped.results.length > 0) {
await fetch(telegramUrl, {
method: "POST",
body: JSON.stringify({
chat_id: env.CHAT_ID,
text: `keywords with sharp drops ${dropped.results.length} detected`,
}),
})
}Use Case Scenarios
- 1Automated daily performance collection: Accumulate in D1 for trend analysis
- 2Early detection of indexing issues: Get alerts when impressions drop sharply
- 3Opportunity keyword discovery: Automatically extract position 11–20 keywords (page 2) → prioritize for rewriting
- 4Page performance ranking: Automatically report top pages by click count
Free Quota
- Default 50,000 queries per day (per project)
- Effectively unlimited for real-world usage
💡 Real-World Insight
While other blogs merely mention "GSC API integration is a good idea," the most critical factor when running a Korean-language site is automated action triggers rather than data collection alone. After six months of operation, the greatest value of the GSC API came from item 3 (automated opportunity keyword extraction). According to Google's official documentation, keywords ranked at positions 11–20 have an average CTR of under 1.5%, but improving just the meta tags, H1, and internal links can raise CTR to 7–12%. This means you can generate more than 5x the impact from the same amount of traffic. For Korean-language sites, Naver accounts for approximately 60% of traffic (based on the 2024 Internet Usage Survey), so it is efficient to handle Naver Search Advisor RSS and sitemap submissions through the same pipeline as GSC. Additionally, since the position field is an average value with significant noise, you should assess trends using at least 14 days of cumulative data — viewing data in 7-day windows makes it difficult to distinguish a "sharp drop" from normal weekday fluctuations.
Closing
Once you integrate the GSC API, you can "detect all issues without ever opening the GSC dashboard." With the CF Workers free plan, cron jobs, D1, and notifications all run at zero cost. If you're serious about SEO, it's absolutely worth a one-week investment.
Reference: Google Search Central
Frequently Asked Questions (FAQ)
Q1. What can I automate with the Google Search Console API?
A: You can automate the collection of query, page, click, impression, CTR, and ranking data to generate reports and identify improvement tasks.
Q2. What do I need to use the GSC API?
A: You need Search Console property access, a Google Cloud project, and either a service account or OAuth authentication.
Q3. How do I set up an SEO automation pipeline?
A: Build it in this order: daily data collection, storage, anomaly detection, keyword clustering, and report delivery.
Q4. How accurate is GSC data?
A: There may be sampling and delays, but it remains the most useful free data available for viewing actual Google search performance.
Q5. How do I find keyword opportunities with the GSC API?
A: Prioritize analyzing queries with high impressions but low CTR, pages ranked 4–15, and URLs that have experienced a sharp drop.
Q6. What should I watch out for in SEO automation?
A: You must handle data delays, brand query separation, country and device filters, and duplicate URL canonicalization.
🔧 Related Free Tools
Related
USD/JPY分散は、為替急変局面で一方通貨の過大シェアを防ぎ、月次の再バランスと上限規則で感情的な一括投資を抑える実践設計です。...
IT6 Ways to Make Side Income with ChatGPT — A Practical, Tested Monetization Guide for 2026USD/JPY分散は、為替急変局面で一方通貨の過大シェアを防ぎ、月次の再バランスと上限規則で感情的な一括投資を抑える実践設計です。...
IT2026 ChatGPT vs Claude vs Gemini — AI Chatbot Performance, Pricing, and Use Cases ComparedUSD/JPY分散は、為替急変局面で一方通貨の過大シェアを防ぎ、月次の再バランスと上限規則で感情的な一括投資を抑える実践設計です。...
ITWebsite Speed Optimization 2026 — How to Achieve Core Web Vitals 90+USD/JPY分散は、為替急変局面で一方通貨の過大シェアを防ぎ、月次の再バランスと上限規則で感情的な一括投資を抑える実践設計です。...