# Ad Library Analyzer: Longest-Running Ads, Hooks, CTAs (`bardach_technologies/ad-library-analyzer`) Actor

Ad library analyzer: turn ad scraper rows into one report per advertiser. Longest-running ads, repeated hooks, calls to action, landing domains, formats and offer signals. Reads Apify datasets or pasted ads. USD 0.002 per advertiser report.

- **URL**: https://apify.com/bardach_technologies/ad-library-analyzer.md
- **Developed by:** [Bardach Technologies](https://apify.com/bardach_technologies) (community)
- **Categories:** Social media, Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 advertiser reports

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/actors/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

**Ad Library Analyzer** turns the ads you already collected into **one report per advertiser**: which ads ran the longest, which opening lines repeat, which calls to action and landing domains they use, how many copy variants they test, and which offers they push. Give it a dataset from an ad library scraper (for example the Facebook Ad Library Scraper), or paste ad objects as JSON, and read the answer to "what is this advertiser really betting on?" in one row.

Ads that stay up for weeks are usually the ones that earn their cost, because nobody keeps paying for an ad that does not work. That makes run time the most useful signal in a list of ads, and it is the one a raw ad list hides. This Actor computes it for every advertiser, next to the hooks and offers that run the longest.

### Sample output

The one-click default run (no dataset, so the built-in sample of 7 made-up ads of two made-up advertisers, counted up to 30.11.2026) wrote these 2 rows, free of charge:

| advertiserName | adsAnalyzed | longRunningAds | longestRunningDays | medianRunDays | distinctCopies |
|---|---|---|---|---|---|
| Northside Roasters (sample) | 4 | 4 | 118 | 49 | 3 |
| Alder & Pine Outdoor (sample) | 3 | 2 | 28 | 20 | 3 |

The names and ads above are made up to show the columns; a real run reports the advertisers in your data. The first row also lists the longest-running ads (118, 79 and 20 days), the repeated opening "fresh beans free shipping on your first order" (2 ads), the landing domain with its ad count and the offer signals (one percentage, two free offers, one promo code, one urgency line).

### Input

Analyze your ads by giving one or both of these; the free sample needs neither.

| Field | What it does |
|---|---|
| `datasetIds` | Up to 5 datasets of ad rows. In the Console you pick them from your account; through the API you pass dataset IDs. The run gets read-only access to the datasets you pick. Search status rows are skipped. |
| `ads` | Ad objects pasted as JSON, up to 5,000. Used together with the datasets. |
| `minDaysRunning` | Days an ad must run to count as long-running. Default 7. |
| `topN` | Longest-running ads listed per advertiser, 1 to 10. Default 3. |
| `maxAdvertisers` | Reports written, 1 to 1,000. Default 100. Advertisers with the most long-running ads come first. |
| `maxItemsPerDataset` | Items read per dataset, up to 20,000. Default 5,000. |
| `asOfDate` | Date like `2026-11-30` up to which active ads count as running. Empty: today (UTC). |
| `useSampleData` | Default on. With no datasets and no ads, run the free built-in sample. Off: a run without ads writes nothing. |

```json
{
  "datasetIds": ["WkzbQMuFYuamGv3YF"],
  "minDaysRunning": 14,
  "topN": 3
}
```

**Which fields are read.** The names the common ad library scrapers use: advertiser `pageId` / `pageName` (also `advertiserId`, `advertiserName`), `libraryId`, `adText` (also `text`, `body`), `headline`, `callToAction`, `displayFormat`, `startDate`, `endDate`, `isActive`, `linkUrl` (also `link`, `landingPageUrl`), `linkCaption` and `platforms`. Dates can be `YYYY-MM-DD`, an ISO time or epoch seconds. A row with no advertiser ID and no advertiser name is skipped and counted. An ad ID that appears twice for one advertiser counts once.

### Output

One row per advertiser in the default dataset (view it as a table, or export JSON, CSV or Excel):

```json
{
  "recordType": "advertiser",
  "advertiserId": "100",
  "advertiserName": "Northside Roasters (sample)",
  "adsAnalyzed": 4,
  "activeAds": 3,
  "longestRunningDays": 118,
  "medianRunDays": 49,
  "longRunningAds": 4,
  "minDaysRunning": 7,
  "longestRunningAds": [
    {"libraryId": "s1", "days": 118, "startDate": "2026-08-04", "isActive": true, "format": "IMAGE",
     "callToAction": "Shop now", "headline": "Fresh beans", "textStart": "Fresh beans, free shipping on your first order.",
     "landingDomain": "northside.example"}
  ],
  "formats": {"CAROUSEL": 1, "IMAGE": 2, "VIDEO": 1},
  "platforms": {"facebook": 4, "instagram": 4},
  "topCallsToAction": [{"value": "Shop now", "count": 3}, {"value": "Learn more", "count": 1}],
  "landingDomains": [{"value": "northside.example", "count": 4}],
  "adsWithTrackingParams": 3,
  "topHooks": [{"value": "fresh beans free shipping on your first order", "count": 2}],
  "distinctCopies": 3,
  "offerSignals": {"percentOff": 1, "freeOffer": 2, "promoCode": 1, "urgency": 1, "question": 0}
}
```

The key-value store record `OUTPUT` holds the run summary: ads analyzed, rows skipped with the reason (`statusRows`, `noAdvertiser`), duplicate ads ignored, advertisers found and reported, and for each dataset whether it was read or could not be read.

### Use cases

- **Competitor research.** See which ads a competitor keeps running, and which hooks and offers come back again and again.
- **Creative briefs.** Start from the openings and calls to action that stayed live the longest.
- **Agency reports.** Turn a scraped ad list into one row per client or competitor, ready for a sheet.
- **Ad testing signals.** Many copy variants with one landing domain often mean a test; one ad that runs for months often means a winner.

### Use it from n8n, Make, the API or an agent

1. Run your ad scraper first and note the dataset ID of the run (its `defaultDatasetId`).
2. Start this Actor with that ID in `datasetIds`. In n8n and Make use the Apify node or module "Run Actor"; through the API send a POST to the Actor's runs endpoint with the same JSON input; an agent can call it through the Apify MCP server.
3. Read the advertiser rows from the run's default dataset.

### Related Actors

- **Facebook Ads Library Scraper: Ads by Page or Keyword** (Apify Store; search for its name) reads the ads an advertiser runs and writes the rows this Actor analyzes.
- **Google Ads Transparency Scraper: Advertiser Ads** (Apify Store; search for its name) reads ads shown through Google; paste or map its rows into `ads`.
- **Merge Datasets & Remove Duplicates by Field** (Apify Store; search for its name) joins several ad datasets into one before you analyze them.

### How it works

1. The ad rows from your datasets and from `ads` are read page by page (up to your item limit).
2. Each row is turned into the same few fields. Search status rows and rows with no advertiser are skipped and counted.
3. Ads are grouped by advertiser ID, or by name when there is no ID.
4. Run time is the days from the start date to the end date; ads still active run up to `asOfDate`.
5. The opening hook is the first sentence in lower case without punctuation. Only hooks used by two or more ads are listed.
6. Offer signals are simple text checks: a percentage or sale, the word free, a promo code, urgency words, a question mark.
7. One row per advertiser is written and charged.

### Limits and good to know

- It analyzes rows you give it. It does not read any ad library or website itself, so it needs no proxy and fails on no site.
- Run time is measured from the dates in your rows. Ads without a start date are counted but have no run time, and a library that shows only a date range for an ad gives only that.
- Long-running is a signal, not proof: a long-running ad can be a brand ad or one nobody switched off. Use it to decide where to look first.
- Offer signals are word checks in English, German and a few common forms; they miss other languages and wordings.
- Landing domains are listed without the full link, so tracking parameters never reach the report. `adsWithTrackingParams` counts the ads that carried them.
- Contact details found in ad text (phone numbers, e-mail addresses) are masked in the text snippets.
- A run that already wrote its reports does not write or charge them again if it is restarted.

### FAQ

**Does it work with ads from other scrapers?** Yes, if the rows carry an advertiser (ID or name) and any of the fields above. Missing fields only leave that part of the report empty.

**What is the difference between this and a scraper?** A scraper collects ads. This Actor reads what a scraper collected and answers which ads matter.

**Can I analyze one advertiser only?** Yes: give a dataset with that advertiser's ads, or paste them into `ads`.

**What does a default run cost?** Nothing but Apify's own start fee: the sample is free.

### Pricing

Pay per event, no subscription; Apify platform usage is not billed on top. **How much does it cost?** Analyzing 20 advertisers costs about USD 0.04 (USD 0.002 per advertiser report). Exactly what is charged:

- **Actor start**: USD 0.00005 per run, charged by Apify (not by this Actor's code) when the run starts. It applies to every run, also runs that write nothing.
- **Advertiser report**: USD 0.002 per report written to the output dataset, charged right after it is written. Sample runs, runs that find no ads, input errors and runs where no dataset can be read write and charge no report.

The `maxAdvertisers` limit and the maximum charge you set for the run both stop the run before more reports are written than you want to pay for.

# Actor input Schema

## `datasetIds` (type: `array`):

Datasets of ad rows, read in the order given, up to 5, for example the output of the Facebook Ad Library Scraper. Pick datasets of your account; through the API pass dataset IDs. Search status rows in them are skipped. Leave empty (with no pasted ads) to analyze a small built-in sample for free.

## `ads` (type: `array`):

Ad objects to analyse without a dataset, up to 5,000. Common field names are read: pageId, pageName, adText, headline, callToAction, startDate, endDate, isActive, displayFormat, linkUrl, platforms, libraryId.

## `minDaysRunning` (type: `integer`):

An ad that ran at least this many days is counted as long-running. Ads that stay up for weeks are usually the ones that pay for themselves.

## `topN` (type: `integer`):

How many of the longest-running ads each report lists, with start date, call to action and the start of the text.

## `maxAdvertisers` (type: `integer`):

Reports written, advertisers with the most long-running ads first. Each report written is charged once.

## `maxItemsPerDataset` (type: `integer`):

Items read from each dataset, 1 to 20,000.

## `asOfDate` (type: `string`):

Date like 2026-11-30 up to which active ads count as running. Empty means today (UTC).

## `useSampleData` (type: `boolean`):

On (default): with no datasets and no ads, a built-in sample of 7 made-up ads is analysed for free. Off: a run without ads writes nothing.

## Actor input object example

```json
{
  "ads": [
    {
      "pageName": "Northside Roasters",
      "adText": "Fresh beans, free shipping.",
      "callToAction": "Shop now",
      "startDate": "2026-10-01",
      "linkUrl": "https://northside.example/beans"
    }
  ],
  "minDaysRunning": 14,
  "topN": 3,
  "maxAdvertisers": 100,
  "maxItemsPerDataset": 5000,
  "asOfDate": "2026-11-30",
  "useSampleData": true
}
```

# Actor output Schema

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

One report per advertiser: run times, hooks, calls to action, landing domains, formats and offer signals.

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

Ads read, ads skipped with the reason, advertisers found and reported, and the datasets read or not readable.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("bardach_technologies/ad-library-analyzer").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("bardach_technologies/ad-library-analyzer").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 '{}' |
apify call bardach_technologies/ad-library-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bardach_technologies/ad-library-analyzer"
        }
    }
}
```

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/1zLNrF5sreNf5S1xs/builds/VWoXek2tXxtlrSlZJ/openapi.json
