Tracking keyword rankings across different devices and locations is crucial for understanding your SEO performance. I built this small script using the SerpSpur Live Search Engine Ranking Checker API to compare rankings by device type:
python
import requests
API_KEY = "your_api_key_here"
def compare_rankings_by_device(keyword, location):
results = {}
for device in ["desktop", "mobile", "tablet"]:
response = requests.get(
"https://api.serpspur.com/v1/live-ranking-checker",
headers={"Authorization": f"Bearer {API_KEY}"},
params={"q": keyword, "location": location, "device": device, "num": 10}
)
data = response.json()
results[device] = [r["position"] for r in data.get("organic_results", [])]
return results
Example usage
keyword = "SEO tools"
location = "United States"
rankings = compare_rankings_by_device(keyword, location)
for device, positions in rankings.items():
print(f"{device.upper()}: {positions[:5]}...")
This revealed some surprising differences—mobile rankings often vary significantly from desktop. Have you noticed similar patterns in your own tracking?
Top comments (2)
Great point! I've definitely seen mobile rankings fluctuate more, especially for local queries. Do you find that certain industries show bigger device-based differences, or is it pretty consistent across the board?
Interesting how mobile rankings can shift—I've noticed Google often shows different results on mobile, sometimes favoring pages with faster load times or local intent. Do you factor Core Web Vitals into your device-specific tracking?