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. 1

    Product queries

    For each product, store a precise query (brand + model) and the country to check.

  2. 2

    Daily snapshot

    Call /shopping for each query and store merchant, title, priceValue, discount and date.

  3. 3

    Matching

    Keep only results whose title contains your model name, to drop accessories and other products.

  4. 4

    Alerts

    Compare today's lowest priceValue with yesterday's and with your own price; notify on changes beyond a threshold.

Complete example

Daily price check with a simple alert (Python). Set 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

1 credit per page of 10 results, $0.50 per 1,000 credits. The first 3,000 credits are free.
ScenarioCredits per monthCost per month
200 products, daily6,000$3.00
2,000 products, daily60,000$30.00
2,000 products, twice a day120,000$60.00

Frequently asked questions

Is priceValue in a single currency?
No: it is the number of the price Google shows for the country you set with gl. Keep the country with each record, and convert currencies yourself if you compare markets.
Can I get every seller of one product?
Not yet. You get the products listed for the query, each with its merchant. Precise queries (brand and model) give the best matches.
How often should I check?
Daily is enough for most catalogs. Checking twice a day doubles the cost; the table above shows the difference.
What if a check fails?
Failed and busy searches are refunded automatically. Retry the product later in the same run.

Start with 3,000 free searches

No credit card. Sign in with Google, create a key, send your first request.