HUVA academy
Free guides
Claude · Guide

Don't spend money on Meta ads until you do this

AM Ani Mkrtchyan 12 min read Updated November 2026

Your competitors test ads and spend money every day. The results are open to everyone in the Meta Ad Library. In this guide Claude collects them, analyses them and shows them to you on one page. You only copy the prompts.

The idea

Why? Nobody pays for months for an ad that doesn't sell. Ads that don't work get switched off, ads that work stay. We call these "survivors".

It's a strong signal, not a guarantee. That's why the tool also looks at how many people each ad reached.

What you get at the end

A dashboard opens in your browser. It's a page where all the ads sit on a map: the further right, the longer the ad has been running; the higher up, the more people it reached. Click an ad and you see why it works. Below, a brief is waiting for you: the plan for your first ad.

What you need

00Fill in your market card

Copy this card into your notes and fill it in. Later you replace the text in square brackets in the prompts.

My Market CardFill in
[YOUR KEYWORDS]: 3 to 5 search words or competitor names
[YOUR MARKET WORDS]: 10 to 20 words that only ads from my market contain
[YOUR SURVIVAL RULE]: 30 days (14 if my market moves fast)
[YOUR BRAND]: brand name and one line about it
[YOUR OFFER]: what exactly I sell and the price or entry point
[YOUR AUDIENCE]: who buys, in one sentence
Market words clean out the noise. Keyword search also brings in random ads, like insurance or Amazon.
Examples
  • Online course: keywords: claude course, ai course, n8n course. Market words: AI, Claude, ChatGPT, n8n, agent, automation, course. Rule: 30 days.
  • Skincare: keywords: vitamin c serum, sunscreen spf 50, The Ordinary. Market words: serum, skin, skincare, spf, acne, glow, retinol. Rule: 14 days, because beauty ads change fast.
  • Dental clinic: keywords: dental implants, teeth whitening, veneers. Market words: dental, dentist, implant, teeth, smile, clinic. Rule: 30 days. There will be few ads from your own city, and that's fine: you learn from the world.
Step by step

Let's build it

Every step works the same way: copy the prompt, replace the brackets, paste it into Claude Code and press Enter.

01Open Claude Code and connect Chrome

Open the Claude app, go to the Code section and choose your empty folder. Then type /chrome in the chat and press Enter. This connects Claude to your Chrome. Test it with this prompt:

Step 1 · Connection testPrompt
Check that you can control my Chrome browser.
Open a new tab, go to https://www.facebook.com/ads/library and describe what you see on the page.
Do not click anything else. Do not log in to anything.

What you should see: a new tab opens in Chrome, and Claude describes the page.

If it doesn't work: Claude says it can't see a browser. Check that Chrome is open and the extension is on, then type /chrome again.

02Collect the ads

Claude opens the Meta Ad Library and reads all the ads for your keywords. Meta sorts them by impressions: number one reached the most people.

Step 2 · Collect the adsPrompt
You are helping me collect public competitor ads from the Meta Ad Library with Claude in Chrome, for market research.

My searches (one search per item): [YOUR KEYWORDS]

For each search:
1. Open the Meta Ad Library in my Chrome tab with: all ads, active ads only, all countries, keyword search. You can use this URL and replace KEYWORD:
https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&q=KEYWORD&search_type=keyword_unordered&media_type=all
Keep the default order. Meta sorts results by impressions, so position 1 reached the most people.
2. Run a small script inside the page that scrolls down so more ads load. Stop when 3 scrolls in a row load nothing new, or at 200 ads.
3. Read every ad card and save these fields:
library_id, advertiser, started_running_on (the "Started running on" date, as an ISO date), ad_text, cta_text, destination_url, media_type (image or video), thumbnail_url, has_multiple_versions (true or false), search_term, rank (position in this search, starting at 1).
4. Save the results in sessionStorage under the key adlib_collect after every scroll. Do NOT use localStorage: Facebook wipes localStorage between pages, sessionStorage survives page changes in the same tab. Add each new search to the saved data, never overwrite it.
5. If Facebook shows a login wall, a captcha or any security check: stop immediately, tell me, and wait. I will solve it by hand. Never try to bypass it.

When all searches are done, tell me how many ads each search returned and the total. Do not export yet.

What you should see: Claude scrolls the page and at the end tells you how many ads it collected. One search gives roughly 100 to 170.

If it doesn't work: zero ads. Type take a screenshot and check the filters.

03Save the data and the images

Facebook image links stop opening after a few days. So Claude downloads the images right now and shrinks them, so the dashboard opens fast.

Step 3 · Export and save imagesPrompt
Now export and save the collected ads. Work in my project folder (the current folder).

1. Read the data from sessionStorage key adlib_collect and download it as ads_raw.json to my Downloads folder.
2. Create the folders data/ and data/media/ in my project folder. Copy ads_raw.json from Downloads to data/ads_raw.json.
3. Download every thumbnail RIGHT NOW, because Facebook image links expire after a few days. Save each one as data/media/[library_id].jpg. For video ads, save the thumbnail image, not the video.
4. Shrink every image so the dashboard loads fast. On macOS use sips to resize it to max 480 pixels on the long side. On Windows, use a built in method and tell me which one.
5. Add a field local_image to each ad in data/ads_raw.json with the path of its saved image. If a download fails, set local_image to null and list the failures.
6. Report: number of ads, images saved, failures, and the total size of data/media.

What you should see: a data folder appears in your folder, with ads_raw.json and the images.

If it doesn't work: Chrome asks whether to allow the download. Click Allow.

04Filter and score

Claude writes a small program that removes the noise and calculates for every ad:

  • how many days it has been running and whether it's a survivor,
  • how it compares to the market median (the middle value across all ads),
  • its position in its search,
  • which advertisers spend consistently.
Step 4 · Clean and scorePrompt
Write a Node script called build-data.mjs in my project folder that turns data/ads_raw.json into evidence. Then run it.

Put these settings at the top of the script so I can edit them:
MARKET_WORDS = [YOUR MARKET WORDS]
SURVIVAL_DAYS = [YOUR SURVIVAL RULE]
TODAY = the date the script runs

Rules:
1. Relevance filter: keep only ads whose ad_text, advertiser or destination_url contains at least one of MARKET_WORDS (ignore upper and lower case). Remove duplicates by library_id.
2. days_live = TODAY minus started_running_on, in whole days.
3. is_survivor = true if days_live is SURVIVAL_DAYS or more.
4. market_median_days = the median days_live of all kept ads. For each ad: x_median = days_live divided by market_median_days, rounded to 1 decimal.
5. Keep rank. percentile = rank divided by the number of ads in that search, times 100. top_10 = true if percentile is 10 or less.
6. verdict: "strong signal" if is_survivor and (x_median is 1.5 or more, or percentile is 25 or less). "worth studying" if is_survivor otherwise. "too early" if not a survivor.
7. Save the kept ads with all fields to data/ads.json.
8. Group by advertiser. For each: ad_count, survivor_count, score = ad_count times survivor_count, video_share, variants_share (share of ads with has_multiple_versions), median_rank, top10_share, median_days_live, and up to 3 library_ids for previews. Save to data/advertisers.json, sorted by score.
9. Save data/summary.json with: run_date, searches, raw_count, relevant_count, advertiser_count, survivor_count, market_median_days.
Show me the summary.

If it doesn't work: very few ads are left. Add market words and type run the build script again. Claude says Node.js is missing? Type install Node.js for me step by step.

05Breakdown and brief

Claude analyses the top 14 survivors. In each one it finds the hook (the first line that stops the scroll), the angle (the reason to buy), the visual, the offer, the proof (numbers, reviews) and the CTA (the ask, for example "Sign up"). Then it finds what repeats and what almost nobody does.

At the end it writes a brief: the plan for your first ad. What to say, to whom, in what form and why.

Step 5 · Breakdown, patterns and briefPrompt
Read data/ads.json and data/summary.json in my project folder.

1. Pick the top 14 survivors: is_survivor = true, sorted by x_median, then by percentile (best first). Take max 3 ads from the same advertiser, so one brand does not dominate.
2. For each one, read the ad text, look at its image in data/media/, and label:
hook (the first line or first visual that stops the scroll), angle (the main reason to buy), visual (what the image or video shows), offer (what exactly is offered), proof (numbers, testimonials, results, authority), cta (the button and the final ask).
Use only what is visible in the ad. Do not invent anything.
3. Find the patterns that repeat in at least 3 of the 14 ads (hooks, angles, offers, proof types, formats). Count how many ads use each one.
4. Find the gap: a hook, angle or proof type that almost nobody here uses, but that makes sense for this market.
5. Save to data/breakdowns.json: ads (library_id, advertiser, the six labels, link https://www.facebook.com/ads/library/?id=[library_id]), patterns (name, description, count, example library_ids), gap.
6. Write a creative brief for MY brand and save it to data/brief.json and brief.md.
My brand: [YOUR BRAND]
My offer: [YOUR OFFER]
My audience: [YOUR AUDIENCE]
The brief contains: one ad concept, hook, angle, visual direction, offer line, proof to use, cta, format (image, carousel or video), why it should work (with the pattern counts as evidence), the gap it uses, and source_ads (the library_ids it is built on).
The concept must be original. Never copy a competitor's text, visual or claim. Learn from the pattern, write my own ad.

Show me the brief when you are done.

If it doesn't work: the brief is too generic. Type make it more specific to my audience.

06Build the dashboard

Step 6 · Build the dashboardPrompt
Build a local dashboard in my project folder that shows the data in data/. Files: index.html, styles.css, app.js and server.mjs. No frameworks, no build step, no login, no external APIs.

server.mjs: a small Node server that serves the folder at http://localhost:4321. Build the folder path with fileURLToPath(import.meta.url), so it works even if my folder path contains spaces.

app.js loads data/ads.json, data/advertisers.json, data/summary.json, data/breakdowns.json and data/brief.json and shows four sections:

1. Evidence map. A chart where every ad is a small thumbnail (from local_image). X axis: days_live, log scale. Y axis: impression rank, log scale, rank 1 at the top. A dashed line at market_median_days. Next to it: a grid of the top ads, and an "inside the ad" panel for the selected ad with: thumbnail, advertiser, days_live, rank, percentile, badges like "top 7% of 'claude course'" and "2.3x the market median days live", the verdict (strong signal, worth studying or too early), the six breakdown labels if the ad was broken down, and a link "Open original ad" to its Ad Library page. Clicking a thumbnail on the map or in the grid selects it.
2. Workflow Engine. The pipeline drawn as connected nodes I can drag: searches, collector, filter, survival gate, advertiser compare, Claude breakdown, pattern library, brief writer, human approval. Each node shows the real count from the data files. Below it, a short trace of the run (step, count, date).
3. Advertiser table: advertiser, ads, video share, variants, median rank, share in top 10%, median days live, and up to 3 small previews. Click a column header to sort.
4. Breakdown and brief: one card per broken down ad, the patterns with their counts, and the brief with links to its source ads.

Style: dark navy background, white text, mono font for labels and numbers, one bright accent colour. Clean and readable on a laptop screen.
At the top show "Snapshot from" and the run_date. Never say the data updates live.

When done, start the server and give me the URL.

What you should see: Claude gives you an address: http://localhost:4321. Open it in Chrome. Localhost means the page runs only on your computer, not on the internet.

Next time, open the same folder in Claude Code and type start the dashboard server.

07Check and fix

Claude opens the dashboard itself, finds the errors and fixes them.

Step 7 · Check and fixPrompt
Open http://localhost:4321 in my Chrome and check the dashboard.
Look for: empty sections, broken images, errors in the console, "not found" pages, nodes that cannot be dragged, a table that does not sort.
Fix everything you find, reload the page to confirm, then tell me what you fixed.
Common errors
  • Every page says "not found": your folder path has a space in it. Type fix server.mjs to use fileURLToPath(import.meta.url).
  • Images don't show: type fix the image paths in data/media.

08Make it yours

Step 8a · Restyle with my brandPrompt
Restyle the dashboard with my brand.
Colours: [YOUR BRAND COLOURS]
Logo file: [PATH TO YOUR LOGO]
Font: [YOUR FONT, or keep the current one]
Rename the section headings to my words: [YOUR WORDING]
Do not change the data, the numbers or the logic.

Every month, repeat steps 2 to 6 with fresh data and compare what changed. The dashboard doesn't update by itself: it's a snapshot from the day you collected the data.

Using it

How to read your dashboard

Look at the top right corner. That's where the ads sit that both run long and reach many people. Start there.

  • Strong signal: a survivor with good numbers. Learn from these first.
  • Worth studying: a survivor with average numbers.
  • Too early: hasn't run 30 days yet. Check again next month.

Rules

  1. Public data only. No private pages, no official API, no paid services.
  2. Link every ad to its original.
  3. Never present a competitor's ad as your own.
  4. Don't claim the dashboard updates live.
  5. Login or captcha: stop and solve it by hand.

Homework

Related guides