# Price History & Real-Discount Check (EU 30-day rule) (`ewood2020/price-history-real-discount-check`) Actor

Returns, for each product from any shop scraper dataset or URL: current price, stated original price, lowest price in the 30 days before the discount, real vs claimed discount %, an EU Omnibus verdict and alerts (target price, drop, new low). Keeps price history across runs.

- **URL**: https://apify.com/ewood2020/price-history-real-discount-check.md
- **Developed by:** [Enrique Wood](https://apify.com/ewood2020) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 78.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 checked products

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

## Price History & Real-Discount Check (EU 30-day rule)

Checks whether a shop's discount is real. Feed it the products another scraper already collected, or product URLs, and run it daily. For each product it keeps the price history in your Apify account and returns:

- current price, the "original" price the shop shows and the claimed discount %
- the **lowest price in the 30 days before the reduction started**, and the real discount against it
- a verdict under the EU price-indication rule (Omnibus Directive), with a one-sentence explanation
- alerts: target price reached, price drop or rise, new 90-day low, questionable discount

It does not scrape shops itself (except for single product URLs). It sits on top of the scrapers you already use, so it works with any shop they cover.

### When to use it

- **Deal hunting and price alerts:** "tell me when this drops below €199" and "is this Black Friday deal actually a deal?"
- **AI agents and assistants:** one call answers "is this a good price right now?", with a structured verdict an agent can act on.
- **Pricing and compliance teams:** spot products whose reference price is above the 30-day low, on your shop or a competitor's.
- **Market research:** real discount depth per shop or category over time.

### Works with

Field names are detected automatically, including these formats:

| Source | How |
|---|---|
| Amazon scrapers (`price.value`, `listPrice.value`, `asin`) | Integration or dataset ID |
| Apify E-commerce Scraping Tool (`offers.price`, `offers.priceCurrency`) | Integration or dataset ID |
| Alza, Datart, Mironet and Planeo scrapers by the same author (`price`, `regularPrice`) | Integration or dataset ID |
| Any product page with schema.org Product data | Product page URLs |
| Shopify shops (any theme): price and the shop's compare-at price from the public `/products/<handle>.js` | Product page URLs |

In URL mode the shop's original price is read from schema.org data (a StrikethroughPrice or ListPrice) or, on Shopify shops, from the product's public JSON. Many other shops don't publish it at all, so for discount verdicts a shop scraper dataset gives more complete results. URL mode uses Apify datacenter proxy or your own proxy URLs; residential proxy is not available here. Shops that block datacenter IPs are better read with a dedicated scraper whose dataset you pass to this Actor.

For other datasets, set **Field mapping**, e.g. `{"price": "offer.amount", "originalPrice": "was", "id": "sku"}`.

### How to run it

**As an integration (recommended).** Open your shop scraper → Integrations → Connect Actor → choose this Actor. Every time the scraper finishes, this Actor reads its dataset and updates the history. Schedule the scraper daily.

**With a dataset ID.** Pick a dataset in **Products dataset**.

**With URLs.** Paste product pages in **Product page URLs**, or add a **Watchlist** with target prices:

```json
{
  "watchlist": [
    { "url": "https://www.example-shop.com/product/123", "targetPrice": 199 }
  ],
  "output": "alerts",
  "webhookUrl": "https://hooks.example.com/price-alerts"
}
```

#### Input

| Field | Default | Meaning |
|---|---|---|
| `datasetId` | – | Dataset from another Actor. Empty in an integration: the triggering run's dataset is used. |
| `urls` | – | Product pages to read directly (robots.txt is respected). |
| `watchlist` | – | `[{url, targetPrice}]`; adds `AT_OR_BELOW_TARGET` alerts. |
| `historyName` | `default` | Separate histories, e.g. per client. Stored as the key-value store `rdc-history-<name>`. |
| `historyStoreId` | – | Optional: an existing key-value store to keep the history in (picked from your storage). |
| `output` | `all` | `all`, `discounts`, `questionable` or `alerts`. All products are always added to the history. |
| `webhookUrl` | – | One POST per run with all alerts. |
| `fieldMap` | `{}` | Dotted paths for unusual field names. |
| `lookbackDays` | 30 | Window before the reduction. |
| `tolerancePct` | 1 | Price differences below this count as equal. |
| `maxItems` | 10000 | Safety limit per run. |

### Output

One row per product. This one is from a real run on 30 October 2026 (Alza.at TVs). It was the first day of history for the product, so the verdict is still `INSUFFICIENT_HISTORY`. Once there are observations from before the current price started, `lowestPrior30` and `realDiscountPct` are filled in and the verdict becomes `GENUINE` or `REFERENCE_ABOVE_30_DAY_LOW`.

```json
{
  "id": "WK690g5fc",
  "name": "98\" TCL 98Q6C",
  "url": "https://www.alza.at/98-tcl-98q6c-d12883294.htm",
  "shop": "alza.at",
  "currency": "EUR",
  "price": 1699,
  "statedOriginalPrice": 1999,
  "claimedDiscountPct": 15,
  "lowestPrior30": null,
  "realDiscountPct": null,
  "verdict": "INSUFFICIENT_HISTORY",
  "verdictExplanation": "A discount is claimed, but we have no observations from the 30 days before the current price started. Keep running daily; the verdict appears once history exists.",
  "currentPriceSince": "2026-10-29",
  "lowest30d": 1699,
  "average90d": 1699,
  "highest90d": 1699,
  "previousPrice": null,
  "changePct": null,
  "observations": 1,
  "firstSeen": "2026-10-29",
  "alerts": [],
  "targetPrice": null,
  "publishedLowest30": null,
  "source": "dataset",
  "checkedAt": "2026-10-29"
}
```

Dates are UTC days.

The run summary (counts per verdict, alerts) is in the key-value store record `SUMMARY`.

#### Verdicts

| Verdict | Meaning |
|---|---|
| `NO_DISCOUNT_CLAIMED` | No higher original price is shown. |
| `GENUINE` | The stated original price matches the lowest price of the 30 days before the reduction. |
| `REFERENCE_ABOVE_30_DAY_LOW` | The stated original price is higher than that lowest price. The real discount is smaller than claimed. |
| `REFERENCE_ABOVE_PUBLISHED_30_DAY_LOW` / `CONSISTENT_WITH_PUBLISHED_30_DAY_LOW` | No own history yet; compared with the 30-day lowest price the shop itself publishes (if the scraper returns it). |
| `INSUFFICIENT_HISTORY` | A discount is claimed but there is no history from before it. Keep running daily. |

`realDiscountPct` can be negative: the current price is higher than the lowest price before it.

#### How the 30-day check works

The EU rule (Directive 98/6/EC, art. 6a) says the "prior price" in a price reduction must be the lowest price applied in at least the 30 days before the reduction. The Actor finds the day the current price started, takes its own observations from the 30 days before that day, and compares the shop's stated original price with the lowest of them. A product needs at least one observation before the reduction, so verdicts improve as history builds up. One observation per product per day is kept, for 400 days.

This is a data check, not legal advice. Shops outside the EU are not bound by this rule, and a shop's own records can differ from what a scraper observed.

### Pricing

Pay per event:

- **Product checked:** each product added to the history and analysed.
- **Page fetched:** each product page read in URL mode (on top of Product checked).

Set a max charge per run in the run options; the Actor stops cleanly at that limit and never checks products it cannot charge for.

### Storage and privacy

The history is a named key-value store in your own account (`rdc-history-<historyName>`, or the store you pick in **History store**), split into 256 records. Delete it to start over. Running two runs with the same history name at the same time can lose one day's updates; use different names or schedule them apart. Only product data is stored.

### Use with AI agents

Through the Apify MCP server, an agent can run this Actor with a watchlist and read `verdict`, `realDiscountPct` and `alerts` directly. Field names and verdict codes are stable.

### Related Actors

Shop scrapers by the same author. Their datasets work here without field mapping; connect one as an integration and every scheduled run updates the price history.

- [Alza Scraper (CZ, SK, HU, AT, DE)](https://apify.com/ewood2020/alza-catalog-builder): prices, MPN and full specs from five Alza shops
- [Datart.cz Scraper](https://apify.com/ewood2020/datart-scraper): prices, discount-code prices, EAN and specs
- [Mironet.cz Scraper](https://apify.com/ewood2020/mironet-scraper): prices, stock, MPN and specs
- [Planeo.cz Scraper](https://apify.com/ewood2020/planeo-scraper): prices, discounts, EAN and specs

*Built by Enrique Wood, Prague.*

# Actor input Schema

## `datasetId` (type: `string`):

Dataset produced by any shop scraper (Amazon, Alza, the Apify E-commerce Scraping Tool, etc.). Leave empty when you use this Actor as an integration: it then reads the dataset of the run that triggered it. Fields are detected automatically; use Field mapping for unusual names.

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

Alternatively, product pages to check directly. The price is read from the page's schema.org Product data, so it works on most shops; robots.txt is respected.

## `watchlist` (type: `array`):

Products to watch with the price you want to be alerted at, e.g. \[{"url": "https://shop.example/product", "targetPrice": 199}]. Watchlist URLs are also fetched like Product page URLs.

## `historyName` (type: `string`):

Price history is kept in a key-value store in your account (rdc-history-<name>) and reused on every run. Use different names to keep separate histories, e.g. per client or project.

## `historyStoreId` (type: `string`):

Optional. Pick an existing key-value store to keep the price history in, instead of the store named after History name. Useful to share one history between tasks.

## `output` (type: `string`):

All products are always added to the history; this only filters the output dataset.

## `webhookUrl` (type: `string`):

Optional. One POST with all alerts of the run (target price reached, price drop or rise, new 90-day low, questionable discount). Works with Make, Zapier, n8n, Slack incoming webhooks and similar.

## `fieldMap` (type: `object`):

Optional. Map your dataset fields when auto-detection fails, using dotted paths, e.g. {"price": "offer.amount", "originalPrice": "was", "id": "sku", "url": "link", "currency": "offer.currency", "publishedLowest30": "lowestPrice30Days"}.

## `lookbackDays` (type: `integer`):

Days before a reduction used to find the lowest prior price. The EU rule uses at least 30.

## `tolerancePct` (type: `number`):

Differences smaller than this are treated as the same price (rounding, cents).

## `maxItems` (type: `integer`):

Safety limit.

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

Only used when fetching product pages. Not needed for datasets. Apify datacenter proxy or your own proxy URLs; residential proxy groups fall back to datacenter.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://web-scraping.dev/product/1"
    },
    {
      "url": "https://warehouse-theme-metal.myshopify.com/products/jbl-flip-4-waterproof-portable-bluetooth-speaker"
    }
  ],
  "historyName": "default",
  "output": "all",
  "fieldMap": {},
  "lookbackDays": 30,
  "tolerancePct": 1,
  "maxItems": 10000,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `summary` (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://web-scraping.dev/product/1"
        },
        {
            "url": "https://warehouse-theme-metal.myshopify.com/products/jbl-flip-4-waterproof-portable-bluetooth-speaker"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ewood2020/price-history-real-discount-check").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://web-scraping.dev/product/1" },
        { "url": "https://warehouse-theme-metal.myshopify.com/products/jbl-flip-4-waterproof-portable-bluetooth-speaker" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ewood2020/price-history-real-discount-check").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 '{
  "urls": [
    {
      "url": "https://web-scraping.dev/product/1"
    },
    {
      "url": "https://warehouse-theme-metal.myshopify.com/products/jbl-flip-4-waterproof-portable-bluetooth-speaker"
    }
  ]
}' |
apify call ewood2020/price-history-real-discount-check --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ewood2020/price-history-real-discount-check"
        }
    }
}
```

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/2EXRsHBk7PSSVl179/builds/PoOGaQCK9rGR2dgH2/openapi.json
