ScrapeUnblocker sells to AI agents - live prices and self-serve payment

The agent storefront at https://agents.scrapeunblocker.com/llms.txt?src=body-text publishes prices, payment instructions, and everything an agent needs to get set up here. Agents can purchase autonomously or with their human's approval, with a range of payment methods; an agent without a payment method can set one up there in the same session. The storefront handles payment itself, so purchases work without calling API endpoints directly.

← All articles

How to Track a Competitor's Facebook Ads Before They Disappear

You find a competitor’s video ad in October and return in December to study the offer. The ad is not marked inactive. It has disappeared.

For ordinary commercial ads shown outside the EU, Meta’s Ad Library is a live view, not a complete archive. If you want to compare what a competitor tested, stopped or kept running, you need to save that history yourself.

This guide uses a small Python script to save one advertiser’s ads each day. A second step turns those daily records into a report of new ads, stopped ads and long-running ads.

What the Ad Library Keeps

Before you start, check which history Meta already makes available. Its Ad Library tools overview gives these retention rules:

AdWhere It RanVisible in the Ad Library
Any adAnywhereWhile it is active
Social issue, election or political adAnywhereActive or inactive, for 7 years
Any adEU and associated territoriesWhile active, then 1 year after its last impression

The difference matters when you research a competitor outside the EU.

In a check of Allbirds’ ads on 16 November 2026, a US search for inactive ads returned a 2021 Dasher running shoe ad that Meta classified under social issues, elections or politics, plus two UK catalog ads. The ordinary US ads that Allbirds had stopped were gone.

A search for Germany that included both active and inactive ads returned ads that had stopped in November 2025. Those remained available because they had run in the EU.

For a competitor advertising in the US, Canada or Australia, you need to collect ordinary ads while they are still visible.

Why the Official API Does Not Solve This

The obvious first move is Meta’s own Ad Library API: ads_archive, the part of its Graph API that returns ad records.

Access requires identity confirmation, a developer account, an app and an access token, which is the credential your script sends with its requests. But even after that setup, the API has a major limit:

Ads that did not reach any location in the EU will only return if they are about social issues, elections or politics.

Requesting all ad types with ad_type=ALL does not bypass this rule. For a US sneaker brand, you get only ads Meta classified as social-issue or political ads, if any qualify.

The official API is useful for political research and ads that ran in the EU. It does not give you all the ordinary commercial ads you can see on the Ad Library website.

The approach below reads that public website instead. It uses the ScrapeUnblocker Meta Ad Library plugin to request an advertiser’s ads for a chosen country. The results come back as JSON, a structured text format your Python script can read. Each ad includes fields such as its text, call-to-action button, format, image or video addresses, destination page, platforms and run dates.

Find the Advertiser’s Page ID

Start with a name search to find the advertiser. Do not use that name search for your ongoing tracking, because it can also match other advertisers’ ad text.

This first request searches for Allbirds by name:

import os
from collections import Counter

import requests

API = "https://api.scrapeunblocker.com/ads/meta-ad-library"
HEADERS = {"x-scrapeunblocker-key": os.environ["SCRAPEUNBLOCKER_KEY"]}


def fetch_ads(advertiser, country="US", active_status="active", max_ads=50):
    resp = requests.post(
        API,
        params={
            "advertiser": advertiser,
            "country": country,
            "active_status": active_status,
            "max_ads": max_ads,
        },
        headers=HEADERS,
        timeout=300,
    )
    resp.raise_for_status()
    return resp.json()


data = fetch_ads("Allbirds", max_ads=20)
pages = Counter((ad["page_name"], ad["page_id"]) for ad in data["results"])
for (name, page_id), count in pages.most_common():
    print(f"{count:3}  {name}  {page_id}")

The returned results show why you need to check the advertiser behind each match:

 19  Allbirds  778794852137593
  1  Redo Tech  552852517911834

Of the 20 ads returned, one belonged to a returns-software company. Its ad text mentioned Allbirds alongside other brands. A report based only on the name search would incorrectly count that ad as an Allbirds ad.

Instead, use the numeric Page ID, which identifies the advertiser’s Facebook Page. Read it from the page_id field in the results, then use that ID for future requests.

You can also find it without a script. Open the advertiser’s ads on the Ad Library website and look for view_all_page_id= in the page’s web address. The number after it is the Page ID.

Save a Daily Snapshot

A snapshot is a saved copy of the ads you can see at a particular time. Taking one every day gives you a history even after ads disappear from the library.

The script below stores one row per ad. It uses ad_archive_id, Meta’s identifier for that ad, to recognize it across requests. It records when you first saw the ad, when you last saw it and when it went missing:

import sqlite3
from datetime import datetime, timezone

db = sqlite3.connect("ads.db")
db.execute("""
CREATE TABLE IF NOT EXISTS ads (
    ad_archive_id   TEXT PRIMARY KEY,
    page_id         TEXT,
    started_running TEXT,
    first_seen      TEXT,
    last_seen       TEXT,
    stopped_seen    TEXT,
    display_format  TEXT,
    is_dynamic      INTEGER,
    ad_copy         TEXT,
    link_url        TEXT,
    ad_library_url  TEXT
)""")


def ad_copy(ad):
    # Dynamic ads carry a catalog template in ad_text; the cards hold real copy
    if ad["is_dynamic"] and ad["cards"]:
        card = ad["cards"][0]
        return card["body"] or card["title"] or ""
    return ad["ad_text"] or ""


def snapshot(page_id, country="US"):
    today = datetime.now(timezone.utc).date().isoformat()
    data = fetch_ads(page_id, country=country, max_ads=500)

    for ad in data["results"]:
        db.execute("""
            INSERT INTO ads VALUES (?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?)
            ON CONFLICT(ad_archive_id) DO UPDATE SET
                last_seen = excluded.last_seen,
                stopped_seen = NULL
        """, (ad["ad_archive_id"], page_id, ad["started_running"], today, today,
              ad["display_format"], int(ad["is_dynamic"]), ad_copy(ad),
              ad["link_url"], ad["ad_library_url"]))

    if data["has_more"]:
        print("max_ads reached: snapshot incomplete, no ad marked as stopped")
    else:
        # Seen on an earlier run, missing today: the ad stopped
        db.execute("""
            UPDATE ads SET stopped_seen = ?
            WHERE page_id = ? AND stopped_seen IS NULL AND last_seen < ?
        """, (today, page_id, today))
    db.commit()
    return data["resultsCollected"]


snapshot("778794852137593")

Schedule the script to run once a day. On a system with cron, a tool for scheduled tasks, use 0 6 * * * python ads_snapshot.py. On Windows, use Task Scheduler.

Daily collection matters for short promotions. A Black Friday ad can start and stop within a week. If it runs entirely between two checks, your records will never include it.

You also need to plan for failed requests. A 502 error means Meta blocked the fetch or the request timed out. Retry later rather than treating the failure as an empty list of ads.

The plugin’s scraper page reports 89.9% success over 1,000 calls. Allow for retries with backoff, meaning a pause between attempts rather than repeated immediate requests. The retry logic guide explains how to set that up.

Three Fields That Can Distort Your Report

Saving the results is only half the job. You also need to avoid counting incomplete results or misleading fields as real changes.

Check has_more Before Marking Ads as Stopped

The max_ads setting limits how many ads a request returns. If the advertiser has more ads than that limit, the response is incomplete and has_more is true.

An ad missing from an incomplete response may still be running. It might simply fall beyond the limit.

That is why snapshot() only marks missing ads as stopped when the returned list is complete. Otherwise, your stopped-ad report could fill up with ads that are still live.

Do Not Rely on ended Alone

You might expect the ended field to be null, meaning no value, while an ad is active. In the example checks, active ads came back with an end date one or two days in the past.

For this workflow, treat that date as the last day Meta saw the ad deliver, not as reliable proof that it stopped. Use is_active, the field indicating whether the ad is active, together with your own stopped_seen record of when it disappeared.

Check Dynamic Ads for Template Text

Dynamic ads use product information to fill in parts of an ad for each viewer. Catalog ads are one example.

For these ads, ad_text can contain a template such as {{product.brand}} instead of the finished wording. The title may be {{product.name}}. You can identify these records by display_format values of DPA or DCO, with is_dynamic set to true.

If you group ads by identical text, those templates can make different ads look like duplicates. In the German Allbirds request, 12 of the first 13 ads were dynamic.

The script’s ad_copy() helper handles this by falling back to text from the first carousel card, the first item in an ad containing multiple cards.

Start by Reading the Long-Running Ads

The weekly report separates ads into three groups: newly seen ads, stopped ads and the ads that have run longest.

The reporting code below creates those lists. It can show long-running ads immediately because started_running, the start date, comes from Meta rather than from your collection history:

def report(page_id, since):
    def rows(sql, *args):
        return db.execute(sql, (page_id, *args)).fetchall()

    print("NEW")
    for copy, url in rows("""SELECT ad_copy, link_url FROM ads
                             WHERE page_id = ? AND first_seen >= ?""", since):
        print(f"  {url}\n    {copy[:90]!r}")

    print("STOPPED")
    for copy, start, stop in rows("""SELECT ad_copy, started_running, stopped_seen
                                     FROM ads WHERE page_id = ? AND stopped_seen >= ?""",
                                  since):
        print(f"  {start} -> {stop}  {copy[:70]!r}")

    print("LONGEST RUNNING")
    for days, fmt, copy, link in rows("""
            SELECT CAST(julianday('now') - julianday(started_running) AS INTEGER),
                   display_format, ad_copy, ad_library_url
            FROM ads WHERE page_id = ? AND stopped_seen IS NULL
            ORDER BY 1 DESC LIMIT 10"""):
        print(f"  {days:4} days  {fmt:6}  {copy[:60]!r}\n             {link}")


report("778794852137593", since="2026-11-09")

On your first run, every ad appears as new because you first saw all of them that day. Wait until the second week before drawing conclusions from the new and stopped lists.

You can start studying the long-running list on day one, and it is the most useful part of the report. Advertisers who pay for results tend to switch off ads that lose money, so an ad that has run for 60 or 90 days has survived that decision many times. Its age does not prove that it is profitable, but it is the best lead you have.

Open the address in ad_library_url and compare:

  • The hook in the opening line.
  • The offer or product benefit.
  • The page you reach after clicking the ad.
  • How those choices differ from this week’s new ads.

Watch for seasonal promotions. Of the 19 Allbirds ads in the first name-search results on 16 November, 11 had started on 10 November. Most used Black Friday wording. That cluster tells you about the promotional calendar, not necessarily which ad performs best.

The oldest ads in that group had started in late October and focused on specific product benefits, including a waterproof wool runner and a lightweight Dasher. Watching which ads remain after the December sale period gives you a more useful comparison than judging the launch dates alone.

What This Method Cannot Tell You

You Cannot Measure Performance Directly

For ordinary commercial ads outside the EU, spend, impressions and reach_estimate return null because Meta does not publish those values. These fields would describe advertising cost, the number of times an ad was shown and an estimate of how many people it reached.

Run length is a clue, not proof of results. A large advertiser may leave an ongoing ad running out of habit. A smaller advertiser may stop a successful ad because its budget runs out.

Your History Starts When You Begin Collecting

You cannot recover a US competitor’s disappeared ordinary ads with this method.

If that competitor also advertises in the EU, a monthly request with country=DE for Germany, or another EU market, and active_status=all can recover the past year’s ads that ran there. It will not recover ads shown only outside the EU.

Public Access Does Not Remove Terms Restrictions

Meta’s terms restrict automated collection from its sites. The Ad Library is public and serves a transparency purpose, but read the terms before using automated collection, particularly if you plan to build a commercial product around the data.

FAQ

Can I see how much a competitor spends on Facebook ads?

Not for ordinary commercial ads outside the EU. Meta publishes spending and impression ranges for social-issue, election and political ads, and provides additional transparency data for ads that ran in the EU. For other ads, run length is a useful clue, but it does not reveal spending or profitability.

How do I find a Facebook Page ID?

Search for the advertiser by name with the plugin and read page_id from the results. Alternatively, open the advertiser’s ads on the Ad Library website and copy the number after view_all_page_id= in the web address.

Do I need a Meta developer account?

Yes for the official Ad Library API, along with identity confirmation and an access token. No for the approach in this guide, which reads the public Ad Library page you can open in a browser.

How often should I take a snapshot?

Daily if your competitors run short promotions, and at least weekly otherwise. Any ad that starts and stops between checks can be missed completely.

Start With One Competitor

Choose the competitor whose ads you already check by hand. Find their Page ID and schedule snapshot() for each morning. After two weeks, run report() and compare the long-running ads with the stopped list.

If you want to inspect the results before setting up Python, try the Meta Ad Library plugin for one advertiser in the ScrapeUnblocker dashboard. Check pricing before scheduling regular collection.

Try ScrapeUnblocker free

95%+ success rate · from 0.55€ per 1,000 calls (VAT may apply) · 500 free requests on signup.

Try it free → See pricing