# Competitor Monitor — Website Change & Price Detection (`apikiy/competitor-monitor`) Actor

Monitor competitor websites for changes: track prices, detect stock availability, and monitor content modifications. Supports multi-page monitoring with scheduled runs for continuous competitor analysis. ⚠️ REQUIRES RESIDENTIAL PROXY to bypass anti-bot protection.

- **URL**: https://apify.com/apikiy/competitor-monitor.md
- **Developed by:** [Julien ApiKiy](https://apify.com/apikiy) (community)
- **Categories:** Automation
- **Stats:** 2 total users, 0 monthly users, 96.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Competitor Monitor - Website Change Detection & Price Tracker

> 🎯 **Monitor competitor websites for changes, track prices, detect stock availability, and stay ahead of the competition.**

[![Competitor Monitor](https://img.shields.io/badge/Apify-Competitor%20Monitor-blueviolet)](https://apify.com)
[![Price Tracker](https://img.shields.io/badge/Price-Tracker-green)](https://apify.com)
[![Stock Monitor](https://img.shields.io/badge/Stock-Monitor-orange)](https://apify.com)

### 🚀 Overview

**Competitor Monitor** is a powerful Apify Actor that automatically monitors competitor websites for changes. Built with PlaywrightCrawler for robust, anti-detection web scraping, it tracks content modifications, price changes, and stock availability across multiple pages.

Perfect for e-commerce businesses, market researchers, and anyone who needs to stay informed about competitor activities.

### ✨ Features

#### 📊 Monitoring Modes

- **Full Page Monitor** - Track any changes across entire web pages
- **CSS Selector Monitor** - Extract and monitor specific elements using CSS selectors
- **Price Tracker** - Dedicated price monitoring with smart parsing (US & EU formats)
- **Stock Monitor** - Detect out-of-stock and back-in-stock events

#### 💰 Price Tracking

- **Smart Price Parser** - Handles $1,299.99 (US) and 1.299,99 € (EU) formats
- **Price Drop Alerts** - Get notified when prices decrease
- **Threshold Control** - Only alert on significant price drops (configurable %)
- **Price History** - Complete price history stored in dataset

#### 📦 Stock Monitoring

- **Out of Stock Detection** - Detect "out of stock", "unavailable", "rupture de stock"
- **Back in Stock Alerts** - Know when items become available again
- **Multi-language Support** - Works with English, French, and other languages

#### 🔍 Change Detection

- **SHA-256 Hashing** - Reliable content comparison using cryptographic hashes
- **Diff Generation** - See exactly what changed between runs
- **Historical Data** - All snapshots stored in Apify dataset

#### 🛡️ Anti-Detection

- **Random User Agents** - Rotates through 7+ realistic browser fingerprints
- **Smart Delays** - 2-5 second random delays between requests
- **Proxy Support** - Works with Apify Proxy or custom proxy configurations
- **Concurrent Browsers** - Up to 5 concurrent browser instances (configurable)

### 📦 Installation

```bash
## Install dependencies
npm install

## Run tests
npm test

## Start the Actor locally
npm start
```

### 🎯 Usage

#### Basic Monitoring

```javascript
{
  "urls": [
    { "url": "https://competitor1.com/product" },
    { "url": "https://competitor2.com/pricing" }
  ],
  "mode": "selector",
  "selectors": [".product-title", ".price", ".description"]
}
```

#### Price Tracking

```javascript
{
  "urls": [
    { "url": "https://competitor.com/product/123" },
    { "url": "https://competitor.com/product/456" }
  ],
  "mode": "price",
  "priceSelector": ".product-price",
  "notifyPriceDrop": true,
  "priceDropThreshold": 10
}
```

#### Stock Monitoring

```javascript
{
  "urls": [
    { "url": "https://store.com/product/sku-123" }
  ],
  "mode": "stock",
  "stockSelector": ".availability",
  "outOfStockKeywords": ["out of stock", "sold out", "unavailable"],
  "inStockKeywords": ["in stock", "add to cart", "buy now"]
}
```

#### Multi-Page Monitoring with Schedule

```javascript
{
  "urls": [
    { "url": "https://competitor.com/products" },
    { "url": "https://competitor.com/pricing" },
    { "url": "https://competitor.com/about" }
  ],
  "mode": "selector",
  "selectors": ["h1", ".content", ".pricing-table"],
  "maxConcurrency": 3,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

### 📋 Input Schema

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `urls` | array | required | List of URLs to monitor |
| `mode` | string | `selector` | Monitor mode: `full-page`, `selector`, `price`, `stock` |
| `selectors` | array | `["body"]` | CSS selectors to extract (for selector mode) |
| `priceSelector` | string | `.price` | CSS selector for price element |
| `stockSelector` | string | `.stock-status` | CSS selector for stock status |
| `notifyOnChange` | boolean | `true` | Trigger on any content change |
| `notifyPriceDrop` | boolean | `true` | Trigger on price decrease |
| `priceDropThreshold` | number | `0` | Minimum % drop to trigger alert |
| `notifyOutOfStock` | boolean | `true` | Trigger when item goes out of stock |
| `notifyBackInStock` | boolean | `true` | Trigger when item comes back in stock |
| `maxConcurrency` | number | `5` | Max concurrent browser pages |
| `proxyConfiguration` | object | `{}` | Proxy settings |

### 📤 Output

Each scrape produces a dataset record with:

```javascript
{
  "url": "https://competitor.com/product",
  "title": "Product Page",
  "contentHash": "abc123...",
  "content": "Extracted content...",
  "price": 49.99,
  "currency": "USD",
  "inStock": true,
  "changed": true,
  "changeType": "price-drop",
  "previousHash": "def456...",
  "previousPrice": 59.99,
  "priceChangePercent": -16.67,
  "diff": "1 changed",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "mode": "price",
  "triggered": true
}
```

### 🔄 Scheduling

For continuous monitoring, schedule the Actor to run automatically:

1. Go to the Actor page on Apify Console
2. Click "Schedule"
3. Set frequency (e.g., every 6 hours, daily)
4. Configure input for your monitoring needs

The Actor maintains state between runs using Apify's Key-Value Store, so each run compares against the previous state.

### 🛠️ Technical Details

- **Crawler**: PlaywrightCrawler (headless Chromium)
- **Anti-Detection**: Random user agents, smart delays, proxy support
- **Storage**: Apify Dataset (results) + Key-Value Store (state)
- **Concurrency**: Configurable up to 20 browsers (default 5)
- **Timeout**: 60 seconds per page

### 📝 Examples

#### Monitor Product Prices Across Competitors

```javascript
{
  "urls": [
    { "url": "https://amazon.com/dp/B09V3KXJPB" },
    { "url": "https://bestbuy.com/site/product/12345678" },
    { "url": "https://walmart.com/ip/123456789" }
  ],
  "mode": "price",
  "priceSelector": "#priceblock_ourprice, .a-price-whole",
  "notifyPriceDrop": true,
  "priceDropThreshold": 5
}
```

#### Monitor Competitor Feature Pages

```javascript
{
  "urls": [
    { "url": "https://competitor.com/features" }
  ],
  "mode": "selector",
  "selectors": [
    ".feature-list",
    ".pricing-tier",
    ".testimonial"
  ]
}
```

### 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

### 💰 Pricing

Pay-per-use, no monthly fees:

| | Price |
|---|---|
| **Actor start** | $0.01 |
| **Per result** | $0.01 |

> 💡 Example: A run returning 500 results costs **$5.01** total ($0.01 start + 500 × $0.01). Runs with 0 results cost only **$0.01**.

### 📄 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

### 🔗 Related Actors

- [Website Content Crawler](https://apify.com/apify/website-content-crawler) - General purpose web scraping
- [SEO Audit](https://apify.com) - SEO analysis tools
- [Price Tracker](https://apify.com) - Specialized price monitoring

***

**Keywords**: website monitor, price tracker, competitor analysis, stock monitor, change detection, web scraping, automation, e-commerce monitoring, price drop alerts, stock availability, web change detection, competitor tracking, market monitoring, price comparison, product monitoring

**Tags**: `monitoring` `price-tracking` `competitor-analysis` `web-scraping` `automation` `e-commerce` `stock-monitoring` `change-detection`

# Actor input Schema

## `urls` (type: `array`):

List of website URLs to monitor for changes. Enter one URL per line.

## `mode` (type: `string`):

What to monitor on each page

## `selectors` (type: `array`):

CSS selectors to extract content from (for 'selector' mode). Supports multiple selectors.

## `priceSelector` (type: `string`):

CSS selector for price element (for 'price' mode). Must point to element containing the price.

## `stockSelector` (type: `string`):

CSS selector for stock status element (for 'stock' mode).

## `outOfStockKeywords` (type: `array`):

Keywords that indicate an item is out of stock (case-insensitive).

## `inStockKeywords` (type: `array`):

Keywords that indicate an item is in stock (case-insensitive).

## `notifyOnChange` (type: `boolean`):

Trigger a notification when any change is detected.

## `notifyPriceDrop` (type: `boolean`):

Trigger a notification when a price decreases.

## `priceDropThreshold` (type: `number`):

Only notify if price drops by at least this percentage.

## `notifyOutOfStock` (type: `boolean`):

Trigger a notification when an item goes out of stock.

## `notifyBackInStock` (type: `boolean`):

Trigger a notification when a previously out-of-stock item becomes available.

## `maxConcurrency` (type: `integer`):

Maximum number of concurrent browser pages.

## `proxyConfiguration` (type: `object`):

Proxy configuration. REQUIRES RESIDENTIAL proxy group for this site. Go to https://console.apify.com/proxy to activate proxy.

## `proxyInfo` (type: `string`):

This actor requires a RESIDENTIAL proxy to work. Reason: Many sites block datacenter IPs. Without proxy, requests will be blocked (403). Enable proxy in your Apify account: https://console.apify.com/proxy

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://example.com"
    }
  ],
  "mode": "selector",
  "selectors": [
    "body"
  ],
  "priceSelector": ".price",
  "stockSelector": ".stock-status",
  "outOfStockKeywords": [
    "out of stock",
    "unavailable",
    "rupture de stock",
    "sold out",
    "currently unavailable"
  ],
  "inStockKeywords": [
    "in stock",
    "available",
    "disponible",
    "add to cart",
    "buy now"
  ],
  "notifyOnChange": true,
  "notifyPriceDrop": true,
  "priceDropThreshold": 0,
  "notifyOutOfStock": true,
  "notifyBackInStock": true,
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        {
            "url": "https://example.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("apikiy/competitor-monitor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [{ "url": "https://example.com" }] }

# Run the Actor and wait for it to finish
run = client.actor("apikiy/competitor-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    {
      "url": "https://example.com"
    }
  ]
}' |
apify call apikiy/competitor-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=apikiy/competitor-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qGntMUvVHoMlWUkl1/builds/eL6z4zmEOeeHVdqmv/openapi.json
