DEV Community

Himanshu Agrawal
Himanshu Agrawal

Posted on

How to Find Winning Facebook Ads with the Meta Ad Library (Days Running and Creative Count Filters)

Disclosure: I built the Facebook Ad Library Scraper used in this guide and earn from its usage on Apify.

The Meta Ad Library shows every active ad on Facebook, Instagram, Messenger, Threads and Audience Network. That is great for research and terrible for finding winners, because a search for "posture corrector" can return hundreds of ads, and many of them are short tests that get switched off within days.

Advertisers do not keep paying for ads that lose money. So two numbers tell you a lot about an ad without any access to its results:

  • Days running: how long the ad has been live. An ad that has run for 30, 60 or 90 days is usually one the advertiser finds worth paying for.
  • Ads using the same creative: how many ads share one creative. When a brand copies one video into 15 ads (new audiences, new countries, new copy), it is scaling something that works.

Neither number is proof of profit, but together they cut a noisy list down to the ads worth studying. This guide shows how to pull only those ads into a spreadsheet with the Facebook Ad Library Scraper on Apify. You need a free Apify account. You do not need a Facebook account or a Meta API token.

Who this is for

  • Dropshippers looking for products that other stores keep advertising.
  • E-commerce brands tracking what competitors run and which offers stay live.
  • Agencies building swipe files for clients and finding brands that spend on Meta.

Step 1: Open the Actor

  1. Go to the Facebook Ad Library Scraper Store page.
  2. Click Try for free and sign in or create an Apify account.
  3. You land on the Input tab in Apify Console.

Step 2: Choose what to search

You have three ways in, and you can combine them:

  • Search keywords: a product, niche or problem, one per line. For example posture corrector, pet hair remover, magnesium gummies. Turn on Match the exact phrase to skip loose matches.
  • Advertisers (Facebook pages): page names, page links or page IDs of competitors.
  • Ad Library links: set any filters on facebook.com/ads/library, copy the link from the address bar and paste it here. Every filter is kept.

Then set Country (for example US), Ad status (active ads are the default, which is what you want for winners), and optionally Media type to video if you only want video creatives.

Step 3: Turn on the winning-ad filters

  • Min days running: start with 30. For saturated niches try 60.
  • Min ads using the same creative: start with 3. Raise it to find creatives that were scaled hard.

Both filters are applied before saving, and ads skipped by them are free. So you can scan a wide keyword and pay only for the ads that pass.

Set Max ads per keyword, advertiser or link to a few hundred. Meta returns about 10 ads per page, so bigger numbers take longer.

Step 4: Run and sort

Click Start. The Output tab shows each ad with its creative thumbnail, advertiser, text, format, start date, days running, active status, the number of ads with this creative, the landing page and a link back to the Ad Library.

Sort by Days running or Ads with this creative and you have a shortlist. For each ad you also get the headline, call to action, images, videos (with HD links), carousel cards, platforms and page details such as likes.

Step 5: Read the shortlist like a media buyer

For each top ad, look at:

  • The landing page (linkUrl): is it a product page, a quiz, an advertorial? Same store or a new one?
  • The hook: the first line of adText and the headline.
  • The offer: discount, bundle, free shipping, guarantee.
  • Format: video, image or carousel, and which platforms it runs on.
  • The page: a new page with one long-running ad is often a product test that worked.

Download the videos and images you want to keep soon, because media links from Meta expire after a few days.

Optional: EU reach and who paid

Turn on Add ad details for ads shown in the EU and you get total EU reach, reach by country, age and gender, the target locations and age range, and who paid for the ad. It costs $0.50 per 1,000 ads more, only when turned on. EU reach exists only for ads shown in the EU.

What it costs

$0.50 per 1,000 ads on paid Apify plans, less on Scale and Business. Ads skipped by the winning-ad filters are free.

Run it from the API with curl

Get your Apify token from Console settings and keep it in an environment variable:

curl -X POST \
  "https://api.apify.com/v2/acts/apisamurai~meta-ad-library-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchQueries": ["posture corrector"], "country": "US", "maxAdsPerSource": 300, "minDaysRunning": 30, "minAdsUsingCreative": 3}'
Enter fullscreen mode Exit fullscreen mode

Run it from Python

Install the client with pip install apify-client:

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])

run = client.actor("apisamurai/meta-ad-library-scraper").call(run_input={
    "searchQueries": ["pet hair remover", "magnesium gummies"],
    "country": "US",
    "maxAdsPerSource": 300,
    "minDaysRunning": 30,
})

ads = list(client.dataset(run.default_dataset_id).iterate_items())
ads.sort(key=lambda a: (a.get("adsUsingThisCreative") or 0, a.get("daysRunning") or 0), reverse=True)

for ad in ads[:20]:
    print(ad["daysRunning"], ad["adsUsingThisCreative"], ad["pageName"], ad.get("linkUrl"))
Enter fullscreen mode Exit fullscreen mode

This prints the 20 most scaled long-running ads with their landing pages.

Integration idea: a weekly winners board in Make

  1. In Apify Console, save a task with your niche keywords and filters, and add a Schedule that runs it every Monday.
  2. In Make, start the scenario with the Apify module "Watch Actor Runs" for that task.
  3. Add "Get Dataset Items" for the finished run.
  4. Write each ad to Airtable or Google Sheets with thumbnail, page, days running, creative count, landing page and Ad Library link.
  5. Add a Slack message for any ad with more than 10 ads using the same creative.

Agencies can run one task per client and share the sheet. The same flow works in n8n or Zapier with their Apify integrations.

Tips

  • Use an Ad Library link when you need a filter the input does not show: it keeps everything you set on the site.
  • Days running counts from the start date to today for running ads, and to the end date for stopped ads.
  • Catalog ads (format DPA) show placeholders such as {% raw %}{{product.name}}{% endraw %} in the headline; the real products are in cards.
  • Run the same search every week and compare: ads that keep showing up are the real winners.

A note on rules

The Ad Library is a public transparency tool. Use the data for research, follow Meta's terms and the laws where you live, and do not copy other brands' creatives as your own. This is not legal advice.


I publish this and other pay-per-result data tools as API Samurai. The full catalog, with prices and code examples for each tool, is at apisamurai.com.

Top comments (0)