Automatic Search Position Monitoring Setup
Search positions aren't static: algorithm updates, competitor activity, site changes — all affect rankings. Learning about changes a week or two later means reacting too late. Auto monitoring gives signal within 24 hours.
Data Sources
Three approaches to getting positions:
Google Search Console API — free, 28 days data, real positions for all queries, but 2–3 day delay. Doesn't allow checking exact position "right now". Good for trend tracking and historical analysis.
Paid APIs (SE Ranking, Serpstat, DataForSEO, Serpwow) — check position for specific keyword in region right now. Cost: $0.001–0.05 per request depending on service and volume.
Direct SERP parsing — technically possible but violates ToS, requires proxy rotation, unreliable. Not used in production.
DataForSEO SERP API Integration
import requests
from base64 import b64encode
class DataForSEOClient:
BASE_URL = 'https://api.dataforseo.com/v3'
def __init__(self, login: str, password: str):
creds = b64encode(f'{login}:{password}'.encode()).decode()
self.headers = {
'Authorization': f'Basic {creds}',
'Content-Type': 'application/json',
}
def check_positions(self, keyword: str, target_domain: str):
payload = [{
'keyword': keyword,
'target': target_domain,
'location_code': 2840,
'language_code': 'en',
'depth': 100,
}]
resp = requests.post(
f'{self.BASE_URL}/serp/google/organic/live/advanced',
headers=self.headers,
json=payload,
timeout=60,
)
return resp.json()
Database Structure
CREATE TABLE tracked_keywords (
id SERIAL PRIMARY KEY,
keyword TEXT NOT NULL,
target_domain TEXT NOT NULL,
search_engine VARCHAR(20) DEFAULT 'google',
location_code INTEGER,
language_code VARCHAR(10),
active BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE position_history (
id SERIAL PRIMARY KEY,
keyword_id INTEGER REFERENCES tracked_keywords(id),
position INTEGER,
url TEXT,
checked_at DATE NOT NULL,
UNIQUE(keyword_id, checked_at)
);
Daily Monitoring Run
Check positions for all active keywords daily and store results.
Alerts on Position Changes
Detect significant changes (threshold 5+ positions) and notify via Telegram.
Cost Calculation
For 100 keywords daily — 100 API requests/day, 3000/month. At DataForSEO rates ($0.003–0.005 per Google SERP) this is $9–15/month. For 500 keywords — $45–75/month.
Timeline
Setup monitoring with PostgreSQL storage and Telegram alerts for one domain — 2–3 working days. Add visualization (Grafana/Metabase), multiple sites support, auto keyword import from GSC — 4–6 days.







