# Ecom Ad Radar — Brand Watchlist & Creative Diff (`ngoctramtong/ecom-ad-radar`) Actor

Monitor competitor Meta ads over time: detect NEW / STOPPED / CHANGED creatives, winner longevity radar, and offer signals. For ecommerce agencies — not a one-shot Ad Library dump.

- **URL**: https://apify.com/ngoctramtong/ecom-ad-radar.md
- **Developed by:** [Ngoc Tram Tong](https://apify.com/ngoctramtong) (community)
- **Categories:** Social media, E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Ecom Ad Radar

**Brand watchlist + creative diff timeline** for Meta Ad Library — not another generic ad dump.

Built for ecommerce media buyers, agencies, and DTC teams who will pay for **change detection**, not raw JSON.

### Why companies pay (moat)

Most Apify Ad Library actors stop at “scrape ads once”.

Ecom Ad Radar persists a **brand snapshot** between runs and emits:

| Signal | Meaning |
|---|---|
| `new` | Creative appeared since last monitor |
| `stopped` | Was active last run, gone now (killed / paused) |
| `changed` | Same ad ID, fingerprint drifted (copy / CTA / media) |
| `isWinner` | Still live + longevity + score threshold |

That temporal layer is what agencies schedule daily and put on Slack.

### Output

Each dataset row includes scrape fields **plus**:

- `changeType`, `changedFields`
- `fingerprint` / `previousFingerprint`
- `firstSeenAt`, `lastSeenAt`, `daysSinceFirstSeen`
- `isWinner`, `offerSignals`, `creativeScore`, `longevityDays`
- cleaned DPA/DCO copy (no `{{product.brand}}` when cards exist)

Key-value outputs:

- `OUTPUT_REPORT` / `OUTPUT_REPORT.md` — agency one-pager (headline, winners, new/stopped/changed)
- `OUTPUT_SUMMARY` — per-brand counts + alerts
- `ALERTS` — short human-readable change digest

Optional **Slack / webhook URL** input sends NEW/STOPPED/CHANGED alerts after monitor runs.

Dataset views: **Overview**, **New & Changed**, **Winners**, **Stopped**.

### Input (agency setup)

1. **Run mode** = `monitor` (default)
2. **Brand watchlist** = list of competitor Page IDs\
   Example: `559929417490965` (Kylie Cosmetics — demo only; use your competitors)
3. **Proxy** = Apify **RESIDENTIAL** + country `US`
4. Optional: **Slack / webhook URL** for change alerts
5. Schedule daily on Apify (Schedules → every 24h)

Optional:

- `winnerMinDays` / `winnerMinScore` — winner radar thresholds
- `snapshotStoreName` — named KVS for history (`ecom-ad-radar-snapshots`)
- `scrape` mode — one-shot dump without diff

### Local

```bash
npm install
npx playwright install chromium
node src/test-extract-sample.js
apify run
```

### Push

```bash
apify login
apify push
```

### How it works

1. Playwright opens Ad Library (handles Meta `rd_verify` / 403 HTML).
2. Parses SSR + intercepts GraphQL while scrolling.
3. Enriches offers / score / platforms / startDate; cleans DPA templates.
4. In **monitor** mode: load previous snapshot → diff → save next snapshot.
5. Push ranked dataset (new → changed → winners → active → stopped).

### Notes

- Do **not** paste personal Facebook cookies into the Actor.
- Diff quality improves after the **second** scheduled run (first run saves baseline).
- Deep pagination depends on Meta UI + proxy quality.

# Actor input Schema

## `runMode` (type: `string`):

monitor = diff vs previous snapshot (new/stopped/changed) — the paid product. scrape = one-shot dump only.

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

Monitor multiple competitor Page IDs in one run. This is the agency workflow.

## `pageId` (type: `string`):

Optional single Page ID (merged into watchlist). Example: 559929417490965 (Kylie Cosmetics).

## `pageUrl` (type: `string`):

Optional label only.

## `keyword` (type: `string`):

Used only when watchlist/pageId are empty (broader, noisier). Diff/snapshots require page IDs.

## `country` (type: `string`):

ISO country code for Ad Library.

## `activeStatus` (type: `string`):

Filter by ad status. Use active for monitor mode (stopped ads are inferred from snapshot gaps).

## `mediaType` (type: `string`):

Filter by creative media.

## `maxAds` (type: `integer`):

Maximum ads to keep per Page ID.

## `scrollRounds` (type: `integer`):

Pagination depth (GraphQL responses are also captured).

## `maxAttempts` (type: `integer`):

Retries with a fresh residential proxy when Meta blocks or returns 0 ads.

## `winnerMinDays` (type: `integer`):

Ads active at least this many days can be flagged as winners.

## `winnerMinScore` (type: `integer`):

Minimum creativeScore to flag a winner.

## `snapshotStoreName` (type: `string`):

Named Apify Key-Value Store used to persist brand snapshots between monitor runs.

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

Optional. Slack Incoming Webhook or any HTTPS endpoint. Sends NEW/STOPPED/CHANGED alerts after each monitor run.

## `notifyOnlyOnChanges` (type: `boolean`):

If true, skip webhook when there are no new/stopped/changed ads (baseline still notifies once).

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

Apify proxy settings. Residential required — Meta blocks datacenter IPs.

## Actor input object example

```json
{
  "runMode": "monitor",
  "watchlist": [
    "559929417490965"
  ],
  "country": "US",
  "activeStatus": "active",
  "mediaType": "all",
  "maxAds": 50,
  "scrollRounds": 8,
  "maxAttempts": 3,
  "winnerMinDays": 14,
  "winnerMinScore": 70,
  "snapshotStoreName": "ecom-ad-radar-snap-v3",
  "notifyOnlyOnChanges": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Enriched ads with changeType, isWinner, fingerprint, offerSignals, creativeScore.

## `report` (type: `string`):

OUTPUT\_REPORT — headline, winners, new/stopped/changed cards for agencies.

## `reportMarkdown` (type: `string`):

Human-readable markdown report (OUTPUT\_REPORT.md).

## `summary` (type: `string`):

OUTPUT\_SUMMARY key with per-brand counts and alerts.

## `alerts` (type: `string`):

Human-readable new/stopped/changed alerts for monitoring runs.

# 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 = {
    "watchlist": [
        "559929417490965"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ngoctramtong/ecom-ad-radar").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 = { "watchlist": ["559929417490965"] }

# Run the Actor and wait for it to finish
run = client.actor("ngoctramtong/ecom-ad-radar").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 '{
  "watchlist": [
    "559929417490965"
  ]
}' |
apify call ngoctramtong/ecom-ad-radar --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0Lv0ubPUyHQ4qkHXg/builds/omfxvqFiW4giJniLn/openapi.json
