← Back to Free Resources

Automate Your SEO Tracking with Claude Code Routines

Build a weekly SEO tracker that pulls data from Google Search Console and writes it to Notion. No coding required. Takes about 30 minutes.

6 steps ~30 min setup By Dominik Gabor

Before you start, you need:

  • A Claude Code Pro subscription (~20 euro/month)
  • A Google Search Console property (your website verified)
  • A Notion account (free tier works)
  • A GitHub account (free tier works)
1

Create a GitHub repo with your reference files

Create a new private repository on GitHub. This is the repo Claude clones on each run. It does not need code. Just two files:

  • .env with your Google OAuth credentials (client ID, client secret, refresh token)
  • README.md with any context Claude should know (your domain, brand notes, reporting preferences)

Tip: Keep the .env file minimal. Only include the credentials Claude needs to authenticate with Google. The refresh token is the critical one.

2

Set up Google Cloud Console

Go to Google Cloud Console and create OAuth 2.0 credentials:

  1. Create a new project (or use an existing one)
  2. Enable the Google Search Console API
  3. Create OAuth 2.0 Client ID credentials (type: Desktop App)
  4. Run the OAuth consent flow to get your refresh token

Critical: Move your OAuth project from Testing mode to Production mode in the OAuth consent screen settings. Testing mode tokens expire every 7 days and your Routine will break silently. Production mode tokens last indefinitely.

3

Create the Notion database

Create a new Notion database with these 8 properties:

PropertyTypeExample
WeekTitleW15 2026
Date RangeText2026-04-07 to 2026-04-13
ImpressionsNumber5,556
ClicksNumber42
CTRNumber (%)0.76%
Average PositionNumber12.3
Top QueriesTextai automation, claude code
NotesTextImpressions up 15% WoW

Copy the database ID from the URL. It is the long string after the workspace name and before the question mark: notion.so/yourworkspace/abc123def456?v=...

4

Create a cloud environment in claude.ai

In claude.ai, go to Settings and create a cloud environment with these variables:

Environment Variables
GSC_CLIENT_ID=your-client-id.apps.googleusercontent.com
GSC_CLIENT_SECRET=your-client-secret
GSC_REFRESH_TOKEN=your-refresh-token
SITE_URL=https://yourdomain.com
NOTION_DATABASE_ID=your-database-id

These variables are encrypted and only accessible during Routine runs. They are not stored in your GitHub repo.

5

Create the Routine

In claude.ai, create a new Routine. Paste this prompt:

Copy this prompt
# Weekly SEO Report

Every Monday at 9:00 AM CET:

1. Calculate the date range for the most recently completed
   Monday-through-Sunday week.

2. Authenticate with Google Search Console using the
   credentials in the cloud environment variables:
   GSC_CLIENT_ID, GSC_CLIENT_SECRET, GSC_REFRESH_TOKEN.

3. Pull search performance data for the site specified in
   SITE_URL for that date range. Include: total impressions,
   total clicks, overall CTR, average position, and the
   top 5 queries sorted by clicks.

4. Format the result into these Notion database fields:
   - Week (e.g. "W15 2026")
   - Date Range (e.g. "2026-04-07 to 2026-04-13")
   - Impressions (number)
   - Clicks (number)
   - CTR (percentage)
   - Average Position (number, one decimal)
   - Top Queries (comma-separated list)
   - Notes (flag any week-over-week changes greater
     than 20% in impressions or clicks)

5. Write a new row to the Notion database specified in
   NOTION_DATABASE_ID.

6. If any step fails, stop immediately and report the
   error. Do not write partial data to Notion.
   Do not retry silently.

Configure the Routine:

  • Repo: your private GitHub repo from Step 1
  • Connectors: enable Notion
  • Schedule: Every Monday at 9:00 AM (or your preferred time)
  • Environment: select the cloud environment from Step 4
6

Test and verify

Click Run now to test manually. Check your Notion database. You should see a new row with all 8 fields populated.

If it fails, Claude will tell you exactly what went wrong in plain English. The most common issues:

  • invalid_grant error: your refresh token is expired or your OAuth project is still in Testing mode (see Step 2)
  • 403 on Search Console: the OAuth scopes do not include Search Console API access. Re-run the consent flow with the correct scope.
  • Notion write fails: make sure the Notion connector is enabled in the Routine settings, and the database ID is correct.

Once it works: let it run on schedule for 2 weeks before trusting it fully. Check the Notion database each Monday to confirm the data looks right.

+

Bonus: Two more prompt templates

Daily Inbox Triage

Copy this prompt
# Daily Inbox Triage

Every weekday at 7:00 AM CET:

1. Read all unread emails from the past 24 hours.

2. Classify each email into one of these categories:
   - URGENT: requires response today
   - ACTION: requires response this week
   - FYI: informational, no response needed
   - SPAM: promotional or irrelevant

3. For each URGENT and ACTION email, write a one-line
   summary and a suggested response (2-3 sentences).

4. Create a Notion page in [database-id] with:
   - Date
   - Total emails processed
   - Urgent count
   - Action count
   - Summary table with: sender, subject, category,
     suggested response

5. If fewer than 3 emails are found, note "light inbox
   day" and still create the summary.

Weekly Team Summary

Copy this prompt
# Weekly Team Summary

Every Friday at 4:00 PM CET:

1. Query the Notion project database [database-id]
   for all tasks updated in the past 7 days.

2. Group tasks by project and status:
   - Completed this week
   - In progress (with % completion if available)
   - Blocked (flag the blocker)
   - New tasks added

3. Write a summary in this format:
   - Opening line: "Week of [date range]: X tasks
     completed, Y in progress, Z blocked."
   - One section per active project with bullet points
   - Blockers section at the end (if any)

4. Create a new page in the team updates database
   [database-id] with the summary.

5. Keep the tone direct and factual. No filler words.
   Numbers over adjectives.

Want Custom AI Automations for Your Business?

These templates handle reporting. But the real value is knowing which of your 50+ manual processes should be automated first. Book a free assessment and I will map the top 3.

Book Your Free AI Profit Assessment

Based on a real implementation. Read the full review: Claude Code Routines: Plain English Business Automation