Price monitoring with Google Shopping data
Price monitoring means checking what merchants charge for your products every day and reacting when a price moves. The BestSERP Shopping endpoint returns the products Google Shopping lists for a query with merchant, price as text and as a number, discount and rating, so 200 products checked daily cost $3 a month.
Last updated:
Key takeaways
- 200 products, daily: 6,000 credits, about $3.00 a month.
- 2,000 products, daily: 60,000 credits, about $30.00 a month.
- Built on the Google Shopping API and the Google Search API.
- A complete Python example is below: set BESTSERP_API_KEY and run it.
The problem
Prices change often, and merchants list the same product under different names. Visiting each store does not scale, and every store needs its own scraper.
Google Shopping already gathers offers from many merchants for a product query. Reading those results daily gives you a price history per merchant from one source and one JSON format.
Suggested architecture
- 1
Product queries
For each product, store a precise query (brand + model) and the country to check.
- 2
Daily snapshot
Call /shopping for each query and store merchant, title, priceValue, discount and date.
- 3
Matching
Keep only results whose title contains your model name, to drop accessories and other products.
- 4
Alerts
Compare today's lowest priceValue with yesterday's and with your own price; notify on changes beyond a threshold.
Complete example
BESTSERP_API_KEY and run it with Python 3.9+ and requests.import os
import time
import requests
API = "https://api.bestserp.com"
HEADERS = {"X-API-KEY": os.environ["BESTSERP_API_KEY"]}
def search(endpoint: str, **body) -> dict:
"""POST one search and return the JSON. Polls while the API answers 202 (still running)."""
r = requests.post(f"{API}/{endpoint}", headers=HEADERS, json={"timeout": 120, **body}, timeout=130)
while r.status_code == 202:
time.sleep(2)
r = requests.get(f"{API}/requests/{r.json()['requestId']}", headers=HEADERS, timeout=30)
r.raise_for_status()
return r.json()
import datetime
import json
PRODUCTS = {
"keychron q1 pro": {"country": "us", "must_contain": "q1 pro", "alert_below": 180.0},
"sony wh-1000xm5": {"country": "us", "must_contain": "xm5", "alert_below": 300.0},
}
today = datetime.date.today().isoformat()
with open("prices.jsonl", "a") as log:
for query, rule in PRODUCTS.items():
offers = [
p for p in search("shopping", q=query, gl=rule["country"], hl="en").get("shopping", [])
if rule["must_contain"] in (p.get("title") or "").lower() and p.get("priceValue") is not None
]
for p in offers:
log.write(json.dumps({"date": today, "query": query, "merchant": p.get("source"),
"title": p.get("title"), "price": p["priceValue"], "shown": p.get("price")}) + "\n")
if offers:
cheapest = min(offers, key=lambda p: p["priceValue"])
note = " <- below alert price" if cheapest["priceValue"] < rule["alert_below"] else ""
print(f"{query}: lowest {cheapest.get('price')} at {cheapest.get('source')}{note}")
else:
print(f"{query}: no matching offers today")
time.sleep(1)What it costs
| Scenario | Credits per month | Cost per month |
|---|---|---|
| 200 products, daily | 6,000 | $3.00 |
| 2,000 products, daily | 60,000 | $30.00 |
| 2,000 products, twice a day | 120,000 | $60.00 |
Frequently asked questions
Is priceValue in a single currency?
Can I get every seller of one product?
How often should I check?
What if a check fails?
Start with 3,000 free searches
No credit card. Sign in with Google, create a key, send your first request.