# Competitor Intelligence & Price Monitor (`palpable_hummingbird/competitor-intelligence`) Actor

Extract product data, prices, and availability from e-commerce pages. Track price changes, stock status, and promotions across repeated runs.

- **URL**: https://apify.com/palpable\_hummingbird/competitor-intelligence.md
- **Developed by:** [Quintin McLaughlin](https://apify.com/palpable_hummingbird) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Competitor Intelligence & Price Monitor

An Apify Actor that extracts structured product data, prices, availability, and promotions from public web pages. Track changes across repeated runs for competitor analysis.

### Features

- **Multi-source extraction**: JSON-LD, OpenGraph, and semantic HTML parsing
- **Change detection**: Compare results across runs to identify price drops, availability changes, and promotions
- **Keyword matching**: Filter and tag pages based on relevant keywords
- **Structured output**: Clean JSON dataset ready for analysis or AI consumption
- **Respectful crawling**: Configurable request delays, duplicate URL handling, graceful error handling

### Usage

#### Input Schema

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `startUrls` | Array<{url: string}> | **Required.** List of public web page URLs to analyze | - |
| `keywords` | string\[] | Optional keywords to match against page content | \[] |
| `maxPages` | number | Maximum pages to process (0 = unlimited) | 100 |
| `requestDelayMs` | number | Delay between requests in ms (higher = gentler) | 1000 |
| `extractMode` | string | Extraction aggressiveness: `auto`, `strict`, or `lenient` | `auto` |
| `proxyConfig` | object | Proxy configuration (optional) | {} |

#### Output Schema

Each record in the dataset contains:

| Field | Type | Description |
|-------|------|-------------|
| `sourceUrl` | string | URL that was requested |
| `finalUrl` | string | Final URL after redirects |
| `domain` | string | Source website domain |
| `productName` | string | Product name extracted from page |
| `price` | number | Current price |
| `currency` | string | ISO 4217 currency code |
| `availability` | string | `in_stock`, `out_of_stock`, `preorder`, or `unknown` |
| `originalPrice` | number | List/original price before discounts |
| `discount` | number | Discount percentage (0-100) |
| `promotionText` | string | Promotional text found on page |
| `description` | string | Product description |
| `imageUrl` | string | Main product image URL |
| `keywordsMatched` | string\[] | Input keywords that matched |
| `scrapedAt` | string | ISO 8601 timestamp |
| `changeDetected` | boolean | Whether changes detected vs. previous run |
| `changes` | array | List of detected changes |
| `extractionMethod` | string | How data was extracted |
| `error` | string | Error message if extraction failed |

### Change Detection

The Actor stores historical data and compares new results. Changes are detected for:

- **Price** - Price increases or decreases
- **Availability** - Stock status changes
- **Product name** - Title/name changes
- **Description** - Description text changes
- **Promotion text** - Promotional messaging changes

### For AI Agent Consumption

Output is designed for easy AI agent consumption:

- All fields are JSON-compatible
- `changeDetected` and `changes` fields enable "what changed?" queries
- `availability` field identifies out-of-stock items
- `discount` field identifies promotions
- `keywordsMatched` helps filter relevant results

Example queries AI agents can answer:

- "What changed since last run?" → Filter by `changeDetected: true`
- "Which competitor lowered price?" → Look for `changes` with `field: 'price'` and `newValue < oldValue`
- "Which products are unavailable?" → Filter by `availability: 'out_of_stock'`
- "Which competitors have promotions?" → Filter by `discount > 0`

### Limitations

- Only extracts from **publicly accessible** pages
- JavaScript-heavy pages may need `lenient` mode or browser-based crawler
- Change detection requires previous runs against same URLs
- Extraction accuracy depends on page structure
- Does not bypass authentication, CAPTCHAs, or anti-bot measures

### Compliance

This Actor only collects **publicly accessible information**. Users are responsible for:

- Complying with applicable website terms of service
- Respecting robots.txt where applicable
- Not exceeding reasonable request rates (use `requestDelayMs`)
- Complying with applicable data protection laws
- Not using extracted data for unauthorized purposes

### Development

#### Install Dependencies

```bash
npm install
```

#### Build

```bash
npm run build
```

#### Run Tests

```bash
node --test tests/test-utils.js tests/test-input-validation.js tests/test-change-detection.js
```

#### Run Locally (with Apify CLI)

```bash
## Set up input.json with your test URLs
apify run
```

### Monetization

This Actor uses the **Pay-per-event (PPE)** pricing model:

- **Primary event**: `product-analyzed` - charged per successfully processed page
- Always pushes data to dataset BEFORE charging (critical for user trust)

### License

ISC

# Actor input Schema

## `startUrls` (type: `array`):

List of public web page URLs to analyze for product and pricing information.

## `keywords` (type: `array`):

Optional keywords or product names to match against page content.

## `maxPages` (type: `integer`):

Maximum number of pages to process in a single run. Use 0 for unlimited.

## `requestDelayMs` (type: `integer`):

Delay between consecutive requests in milliseconds.

## `extractMode` (type: `string`):

How aggressively to extract product data from each page.

## `proxyConfig` (type: `object`):

Optional proxy settings.

## Actor input object example

```json
{
  "startUrls": [],
  "keywords": [],
  "maxPages": 100,
  "requestDelayMs": 1000,
  "extractMode": "auto",
  "proxyConfig": {}
}
```

# Actor output Schema

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

No description

## `changesSummary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("palpable_hummingbird/competitor-intelligence").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 = {}

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

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

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

```

## CLI example

```bash
echo '{}' |
apify call palpable_hummingbird/competitor-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,palpable_hummingbird/competitor-intelligence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

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