Review ratings are a reliable proxy for business quality, customer satisfaction, and market position. A business with hundreds of 4.5-star reviews is a stronger lead than one with 3 reviews and no rating. By querying review data through a search API, you can score leads automatically based on rating, review volume, and recency. This tutorial shows how to extract Google review data for a list of businesses, build a scoring formula, and rank leads by quality. The result is a prioritized lead list that surfaces the highest-value prospects first.
Prerequisites
- Python 3.8+ installed
- requests library installed
- A Scavio API key from scavio.dev
- A list of business names or categories to score
Walkthrough
Step 1: Fetch review data for businesses
Query Google Maps for businesses in a category and extract rating and review count.
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
def get_reviews(query):
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": query, "type": "maps"})
return resp.json().get("local_results", [])Step 2: Build the scoring formula
Score each business based on rating, review count, and a weighted formula.
def score_lead(business):
rating = float(business.get("rating", 0))
reviews = int(business.get("reviews", 0))
# Weight: 60% rating quality, 40% review volume
rating_score = (rating / 5.0) * 60
volume_score = min(reviews / 100, 1.0) * 40
return round(rating_score + volume_score, 1)Step 3: Rank and filter leads
Apply the score to all businesses and sort by quality.
def rank_leads(query, min_score=50):
businesses = get_reviews(query)
scored = []
for b in businesses:
s = score_lead(b)
if s >= min_score:
scored.append({
"name": b.get("title", ""),
"rating": b.get("rating", "N/A"),
"reviews": b.get("reviews", 0),
"phone": b.get("phone", ""),
"score": s,
})
return sorted(scored, key=lambda x: x["score"], reverse=True)Step 4: Export ranked leads
Save the scored and ranked lead list for outreach.
import json
leads = rank_leads("dentists in Chicago IL")
for lead in leads[:10]:
print(f"{lead['score']}pts - {lead['name']} ({lead['rating']} / {lead['reviews']} reviews)")
with open("scored_leads.json", "w") as f:
json.dump(leads, f, indent=2)
print(f"\nExported {len(leads)} scored leads")Python Example
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
def score(query):
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": query, "type": "maps"})
leads = resp.json().get("local_results", [])
for b in leads[:5]:
r = float(b.get("rating", 0))
n = int(b.get("reviews", 0))
print(f"{b['title']}: {r}/5 ({n} reviews) score={round((r/5)*60+min(n/100,1)*40,1)}")
score("dentists in Chicago IL")JavaScript Example
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
async function score(query) {
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST", headers: H,
body: JSON.stringify({platform: "google", query, type: "maps"})
});
const leads = (await r.json()).local_results || [];
leads.slice(0,5).forEach(b => {
const s = (parseFloat(b.rating||0)/5)*60 + Math.min(parseInt(b.reviews||0)/100,1)*40;
console.log(b.title, b.rating, b.reviews, "score=" + s.toFixed(1));
});
}
score("dentists in Chicago IL");Expected Output
A scored and ranked lead list where each business is rated by review quality and volume, with the highest-value prospects surfaced first.