I run a small SaaS and I wanted to track my keyword rankings.
I didn't want to pay $100/month for an SEO tool that I'd only use for one thing.
So I decided to build my own rank tracker.
The first version was a scraper. It worked for a week. Then Google changed something and everything broke.
This is the story of how I rebuilt it properly — using Python and a SERP API — and ended up with a system that can scale to thousands of keywords.
I'm sharing the code and architecture so you can build your own.
I needed to track rankings for about 200 keywords across 3 websites.
My first attempt was a simple Python script using requests and BeautifulSoup.
Here's what happened:
Week 1: It worked perfectly.
Week 2: Google changed their HTML layout. My parser stopped working.
Week 3: I fixed the parser. Then I hit CAPTCHAs.
Week 4: I added proxies. Then I realized search results differ by location.
Week 5: I gave up and started looking for a better solution.
I switched to a SERP API approach.
Instead of scraping Google, I send structured requests and receive structured JSON:
python
import os import requests API_TOKEN = os.getenv("TALOR_API_TOKEN") API_URL = "https://serpapi.talordata.net/serp/v1/request" def google_search(keyword): headers = {"Authorization": f"Bearer {API_TOKEN}"} payload = {"engine": "google", "q": keyword} response = requests.post(API_URL, headers=headers, json=payload) return response.json()
That's it. No proxies. No parser maintenance. No headaches.
Here's the entire system architecture:
text
Keyword List ↓ SERP API Collector ↓ Ranking Processor ↓ Database ↓ SEO Dashboard
Keyword List: The keywords you want to track. Stored in JSON or database.
SERP API Collector: The code above. Returns structured search results.
Ranking Processor: Extracts ranking positions from the results.
Database: Stores historical data.
SEO Dashboard: Displays charts and reports.
The core logic is simple:
python
def find_position(results, domain): organic = results.get("organic_results", []) for item in organic: if domain in item["link"]: return item["position"] return None
python
keywords = [ "python serp api", "google search api", "seo automation" ] for keyword in keywords: results = google_search(keyword) position = find_position(results, "example.com") print(f"{keyword}: {position}")
I've been running this system for 3 months now.
What works:
It runs every morning automatically
It tracks 200+ keywords
No maintenance required
The dashboard shows trends clearly
What I learned:
Historical data is more valuable than current data
Location and device parameters matter
A good API saves months of development time
The SERP API costs $0.25 per 1,000 requests.
For 200 keywords tracked daily:
text
200 keywords × 30 days = 6,000 requests/month 6,000 × $0.25/1,000 = $1.50/month
That's less than one cup of coffee. Compared to $100/month for a commercial SEO tool, it's a huge saving.
TalorData SERP API: https://www.talordata.com/
Python SDK: https://github.com/Talordata/talordata-serp-python
Full tutorial: https://www.talordata.com/blog/google-rank-tracker-python-serp-api
Originally published on the TalorData Blog.