# Website Product Offer Price Change Watch (`practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch`) Actor

Watch public schema.org Product Offer price and availability on a website and report verified changes between runs.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** E-commerce, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 verified changes

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

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

## Website Product Offer Price Change Watch

Give this Actor the root of a public HTTPS website. It reads `robots.txt`, discovers a bounded number of permitted pages from the site's sitemap, and extracts only the public **schema.org `Product` → `Offer`** price and availability that the site itself publishes as JSON-LD. The first run stores a per-domain baseline. Later runs report **verified changes** against that baseline as JSON and CSV.

It does not guess. If a page does not publish a valid price, currency, or availability value, that field stays empty, and a change is reported only when both observations contain the field.

### Quick start (copy this input)

```json
{
    "startUrl": "https://example.com/",
    "maxPages": 25,
    "pathContains": "/products/",
    "requestDelayMs": 500
}
```

Replace `startUrl` with the root of a site you are allowed to monitor. `startUrl` is the only required field.

1. **First run** → status `BASELINE_CREATED`. Nothing is reported as a change and nothing is billed.
2. **Later runs** → `NO_CHANGES` or `CHANGES_DETECTED` with one record per changed offer.
3. Schedule it (Apify Console → Schedules) daily or weekly with the same input.

### Input

| Field | Default | Meaning |
|---|---|---|
| `startUrl` | – | Public HTTPS site root. Paths, ports, credentials, IP addresses, localhost and private hosts are rejected. |
| `maxPages` | 25 (max 200) | Pages fetched per run. |
| `maxSitemaps` | 5 (max 20) | Sitemap / index files fetched per run. |
| `pathContains` | empty | Optional path filter, e.g. `/products/`. |
| `requestDelayMs` | 500 | Pause between page requests; a larger `Crawl-delay` from robots.txt (up to 10 s) wins. |
| `baselineStoreName` | `pal-offer-jsonld-baselines` | Named key-value store holding baselines (key `BASELINE-<domain>`). A named store is required so baselines survive between runs. |
| `resetBaseline` | false | Discard the stored baseline and create a new one. |

### Output

Dataset items (also in key-value store `OUTPUT`, with `CHANGES.csv` for the changes):

- one `run-summary` record: status, error code, page and offer counts, warnings, limitations;
- zero or more `change` records with `changeTypes`, `sourceUrl`, `productName`, `productId`, previous/current price, currency and availability, `baselineObservedAt` and `observedAt`.

Change types: `PRICE_CHANGED`, `AVAILABILITY_CHANGED`, `CURRENCY_CHANGED` (the verified changes), plus informational `NEW_OFFER` and `OFFER_NOT_FOUND_ON_PAGE`.

Statuses: `BASELINE_CREATED`, `NO_CHANGES`, `CHANGES_DETECTED`, `NO_OFFERS_FOUND`, `FAILED` (with an `errorCode` such as `UNSAFE_URL`, `ROBOTS_BLOCKED`, `ROBOTS_UNAVAILABLE`, `SITEMAP_NOT_FOUND`, `SITEMAP_INVALID`, `SITEMAP_UNAVAILABLE`, `NO_PAGES_SELECTED`, `PAGES_UNREACHABLE`).

### Safety behaviour

- HTTPS only; every request and redirect must stay on the exact origin you provided. DNS results must be public addresses.
- `robots.txt` is read first (wildcards, longest-match, `Crawl-delay`). A 401/403 or server error on robots.txt stops the run; a 404 means no restrictions.
- Response sizes are capped (robots 0.5 MB, sitemaps 2 MB, pages 1.5 MB); gzip sitemaps and XML with DTD/entity declarations are rejected.
- No login, no proxies, no contact or personal-data extraction. Only product name, product identifier, price, currency, and availability are stored.

### Billing design

The code defines one pay-per-event name, `verified-change`, counted once per offer with a verified price, currency, or availability change. Baseline, no-change, informational-only, and failed runs are never charged. No payable plan is configured in this project.

### Limitations and caveats

- Only JSON-LD is read; Microdata, RDFa, and prices rendered by JavaScript are not seen.
- Product identity comes from the page's own `sku` / `productID` / `mpn` / `gtin` or, failing that, its name, combined with the page URL. Renaming a product without an identifier looks like a removed plus a new offer. Offers whose identity collides within a page are skipped and counted as ambiguous.
- Coverage is limited to `maxPages` sitemap pages per run, so large catalogs are sampled in sitemap order, and the same pages are checked each time. A change elsewhere is not detected.
- Prices are compared as published; comma-formatted or non-numeric prices are ignored. Currency must be an uppercase ISO-style code. Only known schema.org availability values are accepted.
- An offer missing from a successfully fetched page is reported once and removed from the baseline. A template glitch can therefore cause a false "not found".
- Robots rules are interpreted by a compact parser; unusual files may be read more strictly or loosely than a given search engine does.
- DNS is checked before each request, so a DNS-rebinding attack between check and connect is not fully excluded.
- Baselines accumulate up to 20,000 offers per domain.
- The Actor has not shown that anyone will pay for this. Market interest in broad website crawling says nothing about demand for this narrow monitoring job; the measurable test is whether scheduled users receive changes they act on.

# Actor input Schema

## `startUrl` (type: `string`):

Public HTTPS store root with a working sitemap, e.g. https://www.allbirds.com/. A placeholder domain without a sitemap cannot be run.

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

Upper bound on pages fetched from the sitemap in one run.

## `maxSitemaps` (type: `integer`):

Upper bound on sitemap and sitemap-index files fetched in one run.

## `pathContains` (type: `string`):

Optional case-insensitive filter on the URL path, for example /products/. Leave empty to consider every sitemap URL.

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

Minimum pause between requests. A longer Crawl-delay in robots.txt (capped at 10 seconds) overrides this.

## `baselineStoreName` (type: `string`):

Named key-value store that keeps one baseline per domain between runs. Use lowercase letters, digits and hyphens.

## `resetBaseline` (type: `boolean`):

Ignore the stored baseline and create a new one from this run.

## Actor input object example

```json
{
  "startUrl": "https://www.allbirds.com/",
  "maxPages": 2,
  "maxSitemaps": 5,
  "pathContains": "/products/",
  "requestDelayMs": 500,
  "baselineStoreName": "pal-offer-jsonld-baselines",
  "resetBaseline": false
}
```

# Actor output Schema

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

Download rows from the latest run in JSON/CSV.

# 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 = {
    "startUrl": "https://www.allbirds.com/",
    "maxPages": 2,
    "maxSitemaps": 5,
    "pathContains": "/products/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch").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 = {
    "startUrl": "https://www.allbirds.com/",
    "maxPages": 2,
    "maxSitemaps": 5,
    "pathContains": "/products/",
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch").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 '{
  "startUrl": "https://www.allbirds.com/",
  "maxPages": 2,
  "maxSitemaps": 5,
  "pathContains": "/products/"
}' |
apify call practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-website-product-offer-jsonld-change-watch"
        }
    }
}
```

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/bxCh8hBSrENxd5Iph/builds/2WaH0fIZdXsODkYxI/openapi.json
