Google Business Profile audit

Audit a Google Business Profile in three calls, combining my_business_info, owner photos and place products into one report.
Open as Markdown

This recipe pulls a business's profile, its owner-uploaded photos and its product listings, then flags common gaps: no description, few categories, unclaimed, few owner photos, no products.

Note:

Beta: the business profile, photos and products parsers were written from public documentation and haven't been checked against live responses yet.

Cost per business:

CallPrice
my_business_info (live)$0.00135 at Standard, $0.00234 Rendered, $0.003 Protected
photos with tag=by_owner, up to 30 images$0.0009 per image, at most $0.027
products$0.0015 if the place lists products, $0 if not

All three cache for 24 hours, so a rerun the same day reuses the data at the same price. Send max_age: 0 for a fresh read.

You need: Python 3.9+, requests, DATAFORGAIO_API_KEY.

gbp_audit.py
import os
import sys
 
import requests
 
BASE = "https://api.dataforgaio.com/v1"
KEY = os.environ["DATAFORGAIO_API_KEY"]
BASIC = ("api", KEY)
HEADERS = {"Authorization": f"Bearer {KEY}"}
 
query = sys.argv[1] if len(sys.argv) > 1 else "Blue Bottle Coffee Ferry Building San Francisco"
 
# 1. Profile (DataForSEO shape, task array).
body = requests.post(
    f"{BASE}/business/google/my_business_info/live",
    auth=BASIC,
    json=[{"keyword": query, "language_code": "en", "max_level": "rendered"}],
    timeout=180,
).json()
task = body["tasks"][0]
if task["status_code"] != 20000:
    raise SystemExit(f'profile: {task["status_code"]} {task["status_message"]}')
info = task["result"][0]["items"][0]
cid = info["cid"]
print(f'{info["title"]} | cid {cid} | {info["category"]} | {info["address"]}')
 
# 2. Owner photos (Outscraper shape). Use the cid so we hit the same place.
photos = requests.get(
    f"{BASE}/business/google/photos",
    params={"query": cid, "tag": "by_owner", "photosLimit": 30},
    headers=HEADERS,
    timeout=180,
).json()
owner_photos = photos["data"][0][0]["photos_data"] if photos.get("status") == "Success" else []
 
# 3. Products (Scale SERP shape).
products = requests.get(
    f"{BASE}/business/google/products",
    params={"data_cid": cid, "hl": "en"},
    headers=HEADERS,
    timeout=180,
).json()
product_rows = products.get("place_products_results") or []
 
# 4. Findings.
rating = info.get("rating") or {}
checks = [
    ("Has a description", bool(info.get("description"))),
    ("Claimed by the owner", info.get("is_claimed") is True),
    ("At least 3 categories", 1 + len(info.get("additional_categories") or []) >= 3 if info.get("category") else False),
    ("Has a website", bool(info.get("url"))),
    ("Has a phone number", bool(info.get("phone"))),
    ("Rated 4.0 or higher", (rating.get("value") or 0) >= 4.0),
    ("At least 10 owner photos", len(owner_photos) >= 10),
    ("Lists products", len(product_rows) > 0),
]
for label, ok in checks:
    print(f'  [{"x" if ok else " "}] {label}')
 
print(f'\nrating {rating.get("value")} from {rating.get("votes_count")} reviews; '
      f'{info.get("total_photos")} photos in total, {len(owner_photos)} from the owner; {len(product_rows)} products')
print(f'cost: profile ${task["cost"]} ({task["fetch_level"]}), photos ${photos.get("cost", 0)}, '
      f'products ${products.get("request_info", {}).get("cost", 0)}')

Notes

  • Identify the place once. my_business_info takes a name (plus city), cid:<n> or place_id:<id> as keyword. Use the cid it returns for the photos and products calls so all three describe the same place.
  • Fields that can be null. Fields the place data doesn't carry (category_ids, attributes, place_topics, logo, contact_url) are present and null. Check for null, not just absence.
  • Queue it for many locations. For a portfolio, post profiles to /v1/business/google/my_business_info/task_post (same price) and collect them with tasks_ready and task_get/{id}.
  • Cost control. max_level: "rendered" keeps a profile at $0.00234 or less. photosLimit (or max_cost) caps the photo bill.

Reference: POSTGoogle Business Profile: Live, GETGoogle Business Photos, GETGoogle Business Products.