What you’ll learn: How to set up SearchAPI for SERP monitoring, build automated competitive intelligence, track competitor ad copy changes, and feed search data into AI for strategic analysis.
SearchAPI provides programmatic access to search engine results pages. Instead of manually Googling your competitors, you can systematically monitor every keyword, track ad copy changes, identify new competitors entering your market, and feed all of this data to AI for strategic interpretation. GoogleAdsAgent.ai’s Competitive Monitoring sub-agent is built on exactly this capability.
# 1. Go to: https://www.searchapi.io
# 2. Create account > Dashboard > API Key
# 3. Store your key:
export SEARCHAPI_KEY='your-key-here'
pip install requests
import requests
import os
import json
def get_serp(keyword, location='United States'):
'''Pull Google search results for a keyword.'''
params = {
'engine': 'google',
'q': keyword,
'location': location,
'api_key': os.environ['SEARCHAPI_KEY'],
'num': 10
}
response = requests.get('https://www.searchapi.io/api/v1/search', params=params)
return response.json()
# Monitor your top keywords
keywords = ['running shoes online', 'best marathon shoes', 'trail running gear']
results = {}
for kw in keywords:
serp = get_serp(kw)
results[kw] = {
'ads': serp.get('ads', []),
'organic': serp.get('organic_results', [])[:5],
'ai_overview': serp.get('ai_overview', None)
}
print(f'{kw}: {len(results[kw]["ads"])} ads, {len(results[kw]["organic"])} organic')
def extract_competitor_ads(serp_data):
'''Extract competitor ad copy for analysis.'''
competitors = []
for kw, data in serp_data.items():
for ad in data['ads']:
competitors.append({
'keyword': kw,
'advertiser': ad.get('displayed_link', 'Unknown'),
'title': ad.get('title', ''),
'description': ad.get('description', ''),
'position': ad.get('position', 0)
})
return competitors
comp_ads = extract_competitor_ads(results)
for ad in comp_ads[:5]:
print(f'[{ad["keyword"]}] {ad["advertiser"]}: {ad["title"]}')
import anthropic
client = anthropic.Anthropic()
analysis = client.messages.create(
model='claude-sonnet-4-20250514',
max_tokens=2000,
messages=[{
'role': 'user',
'content': f'''Analyze these competitor ads and identify:
1. Common value propositions (what everyone says)
2. Gaps in messaging (what nobody says)
3. Opportunities for differentiation
4. Recommended ad copy angles to test
Competitor Ads:\n{json.dumps(comp_ads, indent=2)}'''
}]
)
print(analysis.content[0].text)
AUTOMATION: Schedule this script to run daily. Compare today’s results to yesterday’s to detect when competitors change ad copy, launch new campaigns, or exit keywords. GoogleAdsAgent.ai’s Competitive Monitoring sub-agent does exactly this—continuously.
Website: googleadsagent.ai | GitHub: https://github.com/itallstartedwithaidea | Tools: googleadsagent.ai/tools
John Williams | Senior Paid Media Specialist, Seer Interactive | $48M+ managed spend | Creator, GoogleAdsAgent.ai | Hero Conf Speaker | github.com/itallstartedwithaidea
Get a free 30-day audit of your advertising accounts. John will personally review your setup and provide actionable recommendations.
John will review your account and reach out within 24 hours.