# Winning Ads Decoder: Meta Ad Library Intelligence (`scar_ops/winning-ads-decoder`) Actor

Give it competitor brands. It finds which of their Meta ads are making money, compares them with the ads they killed, uncovers hidden signals, and writes new ads for you.

- **URL**: https://apify.com/scar_ops/winning-ads-decoder.md
- **Developed by:** [Aayush Kumar](https://apify.com/scar_ops) (community)
- **Features:** Limited permissions
- **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/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

## Winning Ads Decoder: Meta Ad Library intelligence

**Give it your competitors. It finds which of their Facebook and Instagram ads are actually making money, compares them with the ads they killed, uncovers what they don't want you to see, and writes new ads for you.**

It shows you what your competitors' marketing teams know internally: which ads make money, their campaign names, and even which agency they share.

### Who it's for

- **D2C founders and marketers** who want to know what's working in their category before spending on creative tests.
- **Performance-marketing agencies** that pitch and onboard clients with competitor research.
- **Creative strategists** who need proven hooks and angles, not guesses.
- **Media buyers** who want to see a competitor's testing speed and launch calendar.

Today this means hours of scrolling the Meta Ad Library by hand. This Actor does it in about 3 minutes.

### The insight: winners vs losers, from public data

Brands only keep paying for ads that sell.

- An ad that has been **running for 30+ days is a proven winner**.
- An ad that was **switched off within 7 days is a loser**.

Put the two side by side and you get a free A/B test of your whole market. The Actor reads both, has AI break down every selected ad (hook, angle, offer, format, visual style, text on image, CTA, emotional trigger), and tells you **what keeps ads alive and what gets them killed**, citing real ads.

### What competitors don't want you to see

The Actor also reports:

- **Shared creatives:** near-identical images running on *different* brands' pages, a strong hint of the same agency or a copied ad. Found by fingerprinting every ad image.
- **Campaign leaks:** `utm_campaign` and `utm_content` values left in ad links reveal internal campaign names and funnel stages.
- **Testing velocity:** ads launched per week over the last 8 weeks, median ad lifespan, and kill rate. A high launch rate with a high kill rate means a team that is testing hard and spending.
- **Launch radar:** 5+ new ads within 3 days pointing to the same landing page usually means a sale or a product launch is starting.

### What you get

1. **`report.html`**, a visual report you can share with a client or your team: competitor stat cards, winners vs losers, the winning ads with thumbnails and why they work, hidden signals, and 3-5 new ad scripts. Open it from the **Output** tab.
2. **A dataset**, one row per decoded ad, with the full AI breakdown. Export it to CSV, Excel, or JSON.
3. **`BRIEF`** (JSON) and **`brief.md`** (Markdown, ready to paste into Notion or Google Docs).

#### Example brief excerpt

> **Key difference:** Winners lead with one concrete product benefit in the first line ("up to 42 HRS playtime") and show the product in use; the killed ads opened with brand slogans and contest mechanics.
>
> **Hidden signal:** 6 new ads in 3 days, all pointing to `/collections/bfcm`, 5 still live: a Black Friday push is starting.
>
> **Script 1, hook:** "Your earbuds died on the commute again?"

#### Example dataset rows

| Type | Competitor | Days running | Hook | Angle | Why it works / failed |
|---|---|---|---|---|---|
| winner | BrandA | 813 | "Your never-ending playlist" | Battery life | Turns a spec into an everyday promise and repeats it on the creative |
| winner | BrandB | 61 | "Your phone is expensive. Your powerbank shouldn't be a risk." | Safety fear | Names a risk the buyer already worries about |
| loser | BrandB | 1 | "The fifth quiz of #LeagueOfFans awaits" | Engagement contest | No product, no reason to click for a cold audience |

### How to use it

1. Add your **competitors**. Just type the brand name (for example `boAt`): the Actor finds the brand's own page by its name and website. For a generic name, paste the Facebook page URL for an exact match.
2. Pick the **country** (two-letter code, or `ALL`).
3. Optionally describe **your brand and product**, so the new ad scripts are written for you.
4. Click **Start**. Open **report.html** from the Output tab when it finishes.

#### Input guide

Three fields, nothing else to tune:

| Field | What it does | Default |
|---|---|---|
| Competitors | Brand names or Facebook page URLs | required |
| Country | Where the ads run (two-letter code, or `ALL`) | `IN` |
| Your brand and product | Tailors the new ad scripts to you | empty |

Everything else is set for you, so every report is consistent: up to 80 ads per competitor (half live, half switched off), winners are ads running 30+ days, losers were switched off within 7 days, 8 winners and 6 losers get a full AI breakdown with image analysis, video ads are transcribed when possible, and hidden signals are always on.

### Pricing

Pay per event, so you only pay for what you get:

| Event | Price | When |
|---|---|---|
| Competitor analyzed | $0.30 | each competitor whose ads were fetched |
| Ad decoded with vision | $0.06 | AI read the ad's image and its text |
| Ad decoded (text only) | $0.03 | AI read the text only (no image, or vision off) |
| Video transcribed | $0.10 | each video ad whose audio was transcribed |
| Brief generated | $0.50 | each finished brief and report |

**Worked example:** 3 competitors, 10 ads decoded with vision, 4 text-only, and 2 videos transcribed cost 3 × $0.30 + 10 × $0.06 + 4 × $0.03 + 2 × $0.10 + $0.50 = **$2.32**. The platform usage of the run is billed by Apify to your account on top, about $1.20-1.40 for a typical run (mostly the Meta ad scraper, plus AI tokens). Check the exact figure under **Usage** on any finished run. For comparison, doing this research by hand takes a creative strategist 2-3 hours.

You can set a maximum charge per run. When it is reached, the Actor stops the paid AI work and still finishes the report with what it has.

### Scheduling

Create a **schedule** in Apify Console (for example every Monday at 9:00) to get a fresh report on the same competitors every week, and use Apify's integrations (Slack, Zapier, Make, email) to get notified when it's ready.

### Use it over the API

Run it and get the decoded ads in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/<username>~winning-ads-decoder/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"competitors": ["boAt", "Boult"], "country": "IN", "yourBrand": "Zing - wireless earbuds under Rs 1,500"}'
```

The report is in the run's default key-value store under `report.html`. It also works as a tool for AI agents through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp).

### FAQ

**Where does the data come from?** The public [Meta Ad Library](https://www.facebook.com/ads/library/), which lists every active and recently stopped ad on Facebook, Instagram, Messenger, and Audience Network. No login, no private data.

**Is a long-running ad really a winner?** Lifespan is a strong proxy, not a measured result. Brands rarely keep paying for ads that lose money, but some ads run long for brand reasons. The brief treats lifespan as evidence and says so.

**Why did a brand name not work?** The Actor searches the Ad Library for the name and keeps ads from the page with that name or website. A very generic word (like "Noise") can be drowned out by other advertisers; paste the brand's Facebook page URL instead.

**Why are some competitors thin?** Meta sometimes blocks part of the scrape. The brief lists any competitor that failed or came back thin in its data notes, and one failing competitor never fails the run.

**Why are catalog ads excluded?** Dynamic product ads (text like `{{product.brand}}`) are always-on catalog feeds, not creatives anyone wrote. They're counted in the stats but not analyzed as winners.

**Does it analyze the video itself?** It analyzes the video thumbnail and the ad copy. Transcription of the audio is best effort: Meta video links often can't be transcribed.

### For developers

Python, LangGraph (a fixed pipeline: preflight → resolve → fetch → split → enrich → signals → decode → contrast → brief → publish), and the Apify SDK. It calls [`apify/facebook-ads-scraper`](https://apify.com/apify/facebook-ads-scraper) and, optionally, [`memo23/video-audio-transcriber`](https://apify.com/memo23/video-audio-transcriber). LLMs run through the [Apify OpenRouter proxy](https://apify.com/apify/openrouter), so no provider API key is needed. The proxy only works on the Apify platform, so test with `apify push` and a run in Apify Console.

```bash
apify push
python tests/test_scoring.py && python tests/test_signals_report.py
```

# Actor input Schema

## `competitors` (type: `array`):

The brands you want to spy on. Just type the brand name (e.g. boAt), or paste its Facebook page URL for an exact match. 2-3 competitors give the best brief in about 3 minutes.

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

Where the ads run. Two-letter country code (IN, US, GB, ...) or ALL for every country.

## `yourBrand` (type: `string`):

Who the new ad scripts are for, e.g. "Zing - wireless earbuds under Rs 1,500". Leave empty for generic scripts.

## Actor input object example

```json
{
  "competitors": [
    "boAt",
    "Boult",
    "Mivi"
  ],
  "country": "IN"
}
```

# Actor output Schema

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

No description

## `decodedAds` (type: `string`):

No description

## `brief` (type: `string`):

No description

## `briefMarkdown` (type: `string`):

No description

## `files` (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 = {
    "competitors": [
        "boAt",
        "Boult",
        "Mivi"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scar_ops/winning-ads-decoder").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 = { "competitors": [
        "boAt",
        "Boult",
        "Mivi",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scar_ops/winning-ads-decoder").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 '{
  "competitors": [
    "boAt",
    "Boult",
    "Mivi"
  ]
}' |
apify call scar_ops/winning-ads-decoder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scar_ops/winning-ads-decoder"
        }
    }
}
```

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/vGizPIFbESBhVrphw/builds/n6Vor9nW7ESwqDooZ/openapi.json
