Skip to main content
Independent community resource — not affiliated with the official OpenClaw project. Learn more
Part 3 of 5OpenClaw for E-commerce

Competitor Price Watching with OpenClaw

Responsible use & legal notes

⚠️ Important: Competitor price scraping exists in a legal grey area in many jurisdictions. The data you're monitoring is publicly visible — any customer can see it — but automated collection may violate a site's terms of service. Always check the target site's ToS before monitoring. The configs in this guide cover monitoring publicly listed prices only — not accessing account areas, paywalled content, or internal pricing systems. Some sites actively block scrapers; repeated requests may get your server IP blocked. Use a sensible request delay (2–3 seconds between requests), respect robots.txt rules, and scrape at low frequency (weekly or twice-weekly). This approach gives you the pricing data you need while respecting server resources.

What you can monitor

Price intelligence drives two critical decisions: whether you're undercut, and where you stand in the market. OpenClaw automates the monitoring, so you can react before a competitor's move costs you sales.

Price change detection

Alert when a competitor changes the price of a tracked product — immediately flag whether they went up or down.

Undercut alerts

Immediate flag if a competitor drops below your price — perfect for price-sensitive categories where even 5% matters.

Price gap analysis

Weekly report showing where you're priced high/low vs competitors — grouped by category with flags for overpriced and underpriced products.

Price history tracking

Log prices over time to spot seasonal patterns, promotion cycles, and competitor behavior — historical data beats guessing.

New product detection

Alert when a competitor adds a product in your category — catch new competition before they take market share.

How price scraping works

OpenClaw uses the http-crawler tool to fetch competitor product pages on a schedule. It extracts the price using either a CSS selector (for pages with classic HTML) or JSON-LD ProductPrice schema (for modern structured data), stores the previous price in a state file, and compares on each run. If the price has changed, an alert is triggered. If the extraction fails (page structure changed, selector broke), the agent flags it as a PARSE_ERROR instead of silently returning stale data.

The basic flow is:

  1. Fetch: HTTP GET request to the competitor's product page (with request delay and user-agent to be respectful)
  2. Extract: Parse the HTML or JSON response using your configured CSS selector or schema fallback
  3. Store: Save the current price to state file alongside a timestamp
  4. Compare: Check if price differs from last check — if yes, flag as PRICE_CHANGE
  5. Alert: If change is significant (or meets your alert thresholds), include in the report

Setting up price tracking config

Create a price-watcher agent in your AGENTS.md file. The agent needs a list of competitor products to track, where to extract the price from on each page, and optional thresholds for alerting.

# AGENTS.md — price-watcher agent

agents:
  price-watcher:
    description: "Monitor competitor prices and alert on changes and undercuts"
    tools:
      - http-crawler
    config:
      request_delay_seconds: 3        # be respectful: 3 sec between requests
      user_agent: "Mozilla/5.0 (compatible; your-store-price-monitor)"
      competitor_products:
        - url: "https://competitor-a.com/products/classic-tee-black"
          product_name: "Classic Tee — Black"
          your_sku: "SKU-0001"
          your_price_source: "shopify"  # get your price from your Shopify store
          css_selector: ".product-price"   # fallback CSS selector
          jsonld_fallback: true            # try JSON-LD ProductPrice schema first
        - url: "https://competitor-b.com/shop/hoodie-navy"
          product_name: "Hoodie — Navy"
          your_sku: "SKU-0042"
          your_price_source: "shopify"
          css_selector: "span[data-price]"
          jsonld_fallback: true
        - url: "https://competitor-c.com/products/cap-logo"
          product_name: "Cap — Logo"
          your_sku: "SKU-0089"
          your_price_source: "shopify"
          css_selector: ".price-main"
          jsonld_fallback: true
      state_file: "price_history.json"
      alert_on:
        - price_decrease    # competitor lowers price
        - price_increase    # competitor raises price
      undercut_threshold: 0  # alert if competitor price ≤ your price
    output:
      format: markdown_table
      columns:
        - product
        - your_price
        - competitor_price
        - difference
        - difference_pct
        - change_from_last_check
        - alert_level
      sort_by: difference_pct  # worst (most undercut) first

Key fields:

Detecting price changes

Every time the price-watcher agent runs, it compares the current price against the stored price in price_history.json. If there's a difference, it's flagged. You can set thresholds to ignore tiny fluctuations (e.g. only alert if difference > $0.50).

# Example price_history.json (state file)
{
  "SKU-0001": {
    "product_name": "Classic Tee — Black",
    "last_checked": "2026-03-25T06:00:00Z",
    "last_price": 24.99,
    "current_price": 24.99,
    "change_from_previous": 0,
    "price_history": [
      { "date": "2026-03-18T06:00:00Z", "price": 24.99 },
      { "date": "2026-03-11T06:00:00Z", "price": 26.99 },
      { "date": "2026-03-04T06:00:00Z", "price": 26.99 }
    ]
  },
  "SKU-0042": {
    "product_name": "Hoodie — Navy",
    "last_checked": "2026-03-25T06:00:00Z",
    "last_price": 49.99,
    "current_price": 44.99,
    "change_from_previous": -5.00,
    "alert_level": "UNDERCUT",
    "price_history": [
      { "date": "2026-03-25T06:00:00Z", "price": 44.99 },
      { "date": "2026-03-18T06:00:00Z", "price": 49.99 }
    ]
  }
}

Price gap analysis

Beyond individual price changes, it's useful to see your overall pricing position: are you generally overpriced, underpriced, or competitive? The gap analysis agent aggregates all tracked products and calculates the price gap as a percentage:

# Gap calculation formula
# gap_pct = (your_price - avg_competitor_price) / avg_competitor_price × 100
#
# Example:
#   your_price = $25.00
#   avg_competitor_price = $22.50
#   gap_pct = (25 - 22.5) / 22.5 × 100 = +11%  (you are 11% overpriced)
#
# Interpretation:
#   gap_pct > +15% → OVERPRICED — risk of losing price-sensitive buyers
#   -10% to +15%  → COMPETITIVE — pricing is in line with market
#   gap_pct < -10% → UNDERPRICED — potential margin opportunity

Results are grouped by product category, so you can see pricing position by segment:

# AGENTS.md — price-gap-analyzer agent

agents:
  price-gap-analyzer:
    description: "Analyze price gaps by category and flag overpriced/underpriced products"
    tools:
      - http-crawler
    config:
      state_file: "price_history.json"
      grouping: by_category  # group results by product category tag
      gap_thresholds:
        overpriced: 15       # flag if gap > 15%
        underpriced: -10     # flag if gap < -10%
      min_competitors_to_analyze: 2  # need at least 2 competitors for meaningful gap
    output:
      format: markdown_table
      columns:
        - category
        - product
        - your_price
        - avg_competitor_price
        - gap_pct
        - gap_flag
      sort_by: gap_pct  # most overpriced first

HEARTBEAT.md templates

Weekly price check

# HEARTBEAT.md — weekly price monitoring

schedule:
  - name: "Weekly Price Check"
    cron: "0 6 * * 1"           # Mondays at 6 AM
    agents:
      - price-watcher
      - price-gap-analyzer
    output:
      file: "weekly_price_report.md"
      notify: true
    prompt: |
      Run the price-watcher and price-gap-analyzer agents. Format the output as:
      1. PRICE CHANGES: list products where price changed since last check
      2. UNDERCUTS: highlight any competitors now cheaper than us
      3. OVERPRICED PRODUCTS: products where gap > 15%
      4. UNDERPRICED PRODUCTS: products where gap < -10%
      5. COMPETITIVE: products within -10% to +15% of average competitor
      Keep it scannable. Use emoji for status: 🟢 competitive, 🟡 caution, 🔴 action needed.

Immediate undercut alert (event-based)

# HEARTBEAT.md — real-time undercut alert

schedule:
  - name: "Undercut Alert"
    trigger: on_price_change    # trigger when price-watcher detects a change
    condition: "alert_level == 'UNDERCUT'"  # only if competitor is now cheaper
    agents:
      - price-watcher
    output:
      file: "undercut_alert_[product].md"
      notify: true
    prompt: |
      A competitor has dropped below our price. Output:
      - Product name and SKU
      - Their new price and our current price
      - Percentage gap
      - Action recommended (adjust price down, margin accept it, monitor only)

What the weekly report looks like

━━ Weekly Price Check — 25 Mar 2026 ━━
🔴 UNDERCUTS (1 product now cheaper than us)
Classic Tee — Black | Our: $24.99 | Competitor A: $22.99 | Gap: -8%

🟡 PRICE CHANGES (2 detected)
Hoodie — Navy | was $49.99 → now $44.99 | down $5.00 (competitor B)
Cap — Logo | was $18.99 → now $19.99 | up $1.00 (competitor C)

🔴 OVERPRICED (gap > 15%)
Tote Bag — Natural | Our: $35.00 | Avg Competitor: $28.50 | Gap: +23%

🟢 COMPETITIVE (-10% to +15%)
Cap — Logo | Our: $19.99 | Avg Competitor: $19.49 | Gap: +2%
Sweatshirt | Our: $54.99 | Avg Competitor: $54.20 | Gap: +1%

📊 SUMMARY: 4 products tracked | 1 undercut | 2 price changes | 1 overpriced
Recommendation: Consider $2 price drop on Classic Tee Black to regain competitiveness.

Frequently asked questions

Is scraping competitor prices legal?

It exists in a legal grey area depending on your jurisdiction and the target site's terms of service. The data is publicly visible — any customer can see it — but automated collection may violate a site's ToS. Always check the target site's terms before monitoring. This guide covers monitoring publicly listed prices only, not accessing account areas, paywalled content, or internal pricing data.

What if the competitor changes their page structure?

If the CSS selector you configured breaks (because the competitor updated their HTML), the price extraction returns null. The agent flags this as a PARSE_ERROR rather than silently failing or returning a stale price. You then update the CSS selector in your config to match the new page structure.

How often should I check competitor prices?

Weekly is a good baseline for most products. Highly competitive categories may warrant twice-weekly checks. Avoid daily scraping — it strains the target server and increases the risk of your server IP getting blocked. Use sensible request delays (2–3 seconds between requests) and respect robots.txt rules.

Can OpenClaw track prices on Amazon?

Amazon actively blocks scrapers. If you're an Amazon Associate, use Amazon's Product Advertising API instead. For non-associates, consider commercial data providers like Keepa or DataForSEO's Amazon API endpoints. Standard web scraping of Amazon will result in IP blocks.