# Competitor Price & Stock Alerts (`monema/apify-price-tracker`) Actor

Track product prices, stock status, and restocks across public pages with change detection and webhook delivery.

- **URL**: https://apify.com/monema/apify-price-tracker.md
- **Developed by:** [Maarten Vreeburg](https://apify.com/monema) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 0 monthly users, 96.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 price or stock 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

## Price Tracker & Alerts

![Price Tracker Thumbnail](assets/thumbnail.jpg)

![Hero banner](assets/hero.jpg)

Track competitor prices, stock status, and restocks without babysitting product pages. This Actor watches a URL or selector, detects meaningful changes, and can notify your webhook when a commercial signal moves.

**Buyer outcome:** know when to reprice, restock, investigate a supplier, or trigger an automated workflow.

### Who buys this

- e-commerce operators tracking competitor pricing
- founders watching suppliers or marketplaces
- traders and deal hunters monitoring listings
- affiliate marketers tracking offer pages
- teams that need reliable alerts instead of manual checking

### What it does

- monitors a full page or a specific CSS selector
- parses price values from visible text
- supports a custom price regex for tricky pages
- ignores noisy page sections before comparison
- keeps persistent state per tracked target
- sends webhook alerts on meaningful price changes

### How it works

1. Fetch the page with a browser-like user agent.
2. Strip noisy sections like cookie banners and ads.
3. Extract either the whole page or a target container.
4. Parse the first visible price or use your custom regex.
5. Compare against the stored snapshot from the previous run.
6. Send a webhook if the change is meaningful.

### Input example

```json
{
  "url": "https://example.com/product",
  "selector": "main",
  "ignore_selectors": ".cookie-banner,.ads,.promo",
  "min_change_ratio": 0.02,
  "webhook_url": "https://your-endpoint.example/webhook"
}
```

### Output fields

- `status`
- `price_changed`
- `significant_change`
- `current_price_value`
- `previous_price_value`
- `currency`
- `percent_change`
- `message`
- `final_url`

### Good use cases

- track competitor price cuts
- detect restock / sale page updates
- monitor marketplace listings
- catch supplier pricing changes early
- forward changes to Slack, Discord, Zapier, Make, or a backend webhook

### Local development

```bash
apify run
```

### Deploy

```bash
apify login --token <your-token>
apify push
```

# Actor input Schema

## `url` (type: `string`):

The URL of the page you want to track for price changes.

## `selector` (type: `string`):

Optional CSS selector for the specific product or price container. If omitted, the whole page is scanned.

## `ignore_selectors` (type: `string`):

Comma-separated CSS selectors to remove before price parsing (for example: '.cookie-banner,.ads,.promo').

## `price_regex` (type: `string`):

Optional regex with a named 'amount' group (and optional 'currency' group) for pages with unusual price formatting.

## `enable_stock_detection` (type: `boolean`):

Detect common in-stock / out-of-stock phrases and include stock status in the result.

## `min_change_ratio` (type: `number`):

Only treat a text change as meaningful if the normalized difference is at least this ratio. Set to 0 for any change.

## `webhook_url` (type: `string`):

Optional endpoint that receives the JSON result when a meaningful price change is detected.

## `state_key` (type: `string`):

Optional custom state key source when you want multiple runs to share or separate stored snapshots.

## `user_agent` (type: `string`):

Optional HTTP user agent string.

## `timeout_seconds` (type: `number`):

Request timeout in seconds.

## Actor input object example

```json
{
  "url": "https://www.example.com/",
  "ignore_selectors": ".cookie-banner,.advertising,.ads",
  "enable_stock_detection": true,
  "min_change_ratio": 0.02,
  "timeout_seconds": 30
}
```

# 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 = {
    "url": "https://www.example.com/",
    "ignore_selectors": ".cookie-banner,.advertising,.ads"
};

// Run the Actor and wait for it to finish
const run = await client.actor("monema/apify-price-tracker").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 = {
    "url": "https://www.example.com/",
    "ignore_selectors": ".cookie-banner,.advertising,.ads",
}

# Run the Actor and wait for it to finish
run = client.actor("monema/apify-price-tracker").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 '{
  "url": "https://www.example.com/",
  "ignore_selectors": ".cookie-banner,.advertising,.ads"
}' |
apify call monema/apify-price-tracker --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/lTpvFIsPx2eTXqjSw/builds/AioC4Wc1BySUoj9St/openapi.json
