Daily price tracking for Google Shopping products is essential for competitive intelligence, arbitrage opportunities, and purchase timing. Manual price checking is tedious and misses overnight changes. An automated pipeline that queries Google Shopping via API, stores price history, and detects significant changes catches every price movement. This tutorial shows how to build a daily Google Shopping price tracker using the Scavio API. You will set up product monitoring, store daily snapshots, calculate price trends, and generate alerts for significant price changes.
Prerequisites
- Python 3.8+ installed
- requests library installed
- A Scavio API key from scavio.dev
- A list of products to track
Walkthrough
Step 1: Define products to track
Set up the product list and price history storage.
import os, requests, json
from datetime import date
API_KEY = os.environ["SCAVIO_API_KEY"]
HISTORY_FILE = "shopping_price_history.json"
PRODUCTS = [
"MacBook Air M4",
"Sony WH-1000XM5",
"iPad Pro 13 inch",
"Samsung Galaxy S25",
]Step 2: Fetch daily prices
Query Google Shopping for each product and extract current pricing.
def fetch_price(product):
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": product, "type": "shopping"})
results = resp.json().get("shopping_results", [])[:10]
prices = []
for r in results:
price_str = r.get("price", "").replace("$","").replace(",","")
try:
prices.append({"title": r["title"][:60], "price": float(price_str),
"seller": r.get("source",""), "link": r.get("link","")})
except (ValueError, KeyError):
continue
return sorted(prices, key=lambda x: x["price"]) if prices else []Step 3: Store daily snapshots
Save price data with dates for historical comparison.
def load_history():
try:
with open(HISTORY_FILE) as f:
return json.load(f)
except FileNotFoundError:
return {}
def save_daily(product, prices):
history = load_history()
if product not in history:
history[product] = []
if prices:
history[product].append({
"date": date.today().isoformat(),
"lowest": prices[0]["price"],
"seller": prices[0]["seller"],
"avg": round(sum(p["price"] for p in prices) / len(prices), 2),
})
with open(HISTORY_FILE, "w") as f:
json.dump(history, f, indent=2)Step 4: Detect price changes and alert
Compare today's prices with yesterday's and flag significant drops.
def daily_tracker(products, alert_threshold=5.0):
history = load_history()
alerts = []
for product in products:
prices = fetch_price(product)
if not prices: continue
lowest = prices[0]["price"]
prev_entries = history.get(product, [])
prev_price = prev_entries[-1]["lowest"] if prev_entries else lowest
change_pct = ((lowest - prev_price) / prev_price * 100) if prev_price else 0
save_daily(product, prices)
status = "DROP" if change_pct <= -alert_threshold else "RISE" if change_pct >= alert_threshold else "STABLE"
print(f"{status}: {product} ${lowest:.2f} ({change_pct:+.1f}%)")
if status == "DROP":
alerts.append({"product": product, "price": lowest, "change": round(change_pct,1)})
return alerts
alerts = daily_tracker(PRODUCTS)Step 5: Generate price trend summary
Summarize price trends over the tracked period.
def price_trends():
history = load_history()
for product, entries in history.items():
if len(entries) < 2: continue
first = entries[0]["lowest"]
last = entries[-1]["lowest"]
change = ((last - first) / first) * 100
lowest_ever = min(e["lowest"] for e in entries)
print(f"{product}:")
print(f" Current: ${last:.2f} | Low: ${lowest_ever:.2f} | Trend: {change:+.1f}%")
price_trends()Python Example
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
def price(product):
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": product, "type": "shopping"})
items = resp.json().get("shopping_results", [])[:5]
for i in items:
print(f"{i.get('title','')[:40]} - {i.get('price','N/A')} ({i.get('source','')})")
price("MacBook Air M4")JavaScript Example
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
async function price(product) {
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST", headers: H,
body: JSON.stringify({platform: "google", query: product, type: "shopping"})
});
const items = (await r.json()).shopping_results || [];
items.slice(0,5).forEach(i =>
console.log(i.title?.slice(0,40), i.price, i.source)
);
}
price("MacBook Air M4");Expected Output
A daily price tracking pipeline that monitors Google Shopping products, stores price history, detects significant drops, and generates trend summaries.