Plan, check and optimize paid ad campaigns on Google, Meta, LinkedIn, X and TikTok: sizes an audience from the numbers you supply (with the arithmetic shown), checks budget fit, computes CPC/CPA/ROAS against your own targets, and checks ad copy against documented platform specs with rewrites from your own words. Use when running PPC or paid social, sizing a targeting plan, judging a campaign export, or fixing ad copy before launch.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Paid Ads?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/borghei-paid-ads)
---
name: paid-ads
description: >
Plan, check and optimize paid ad campaigns on Google, Meta, LinkedIn, X and TikTok:
sizes an audience from the numbers you supply (with the arithmetic shown), checks budget
fit, computes CPC/CPA/ROAS against your own targets, and checks ad copy against documented
platform specs with rewrites from your own words. Use when running PPC or paid social,
sizing a targeting plan, judging a campaign export, or fixing ad copy before launch.
license: MIT
metadata:
version: 2.1.0
author: borghei
category: marketing
domain: advertising
updated: 2026-12-03
tags:
- paid-ads
- google-ads
- meta-ads
- linkedin-ads
- retargeting
- bidding
---
# Paid Ads
Campaign strategy, audience sizing, budget fit, performance checks and ad copy review across the
major ad platforms. The scripts never invent numbers: an audience size, a benchmark or a target
comes from you or from a named source, and anything else is reported as missing.
---
## Table of Contents
- [Keywords](#keywords)
- [Clarify First](#clarify-first)
- [Quick Start](#quick-start)
- [Tools](#tools)
- [LinkedIn Ads](#linkedin-ads)
- [Exit Codes](#exit-codes)
- [Example Run](#example-run)
- [Campaign Playbook](#campaign-playbook)
- [Pre-Launch Checklist](#pre-launch-checklist)
- [Best Practices](#best-practices)
- [Troubleshooting](#troubleshooting)
- [Integration Points](#integration-points)
- [Scope & Limitations](#scope--limitations)
---
## Keywords
paid ads, PPC, pay-per-click, Google Ads, Meta Ads, Facebook Ads, Instagram Ads, LinkedIn Ads, Twitter Ads, X Ads, TikTok Ads, paid media, ROAS, CPA, CPC, CPM, audience targeting, audience size, retargeting, remarketing, budget optimization, bid strategy, ad campaigns, conversion tracking, lookalike audiences, campaign structure, ad performance, paid search, paid social, responsive search ads, ad copy
---
## Clarify First
Before building the campaign, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
- **Campaign objective:** leads, sales, traffic, or awareness (drives platform selection, campaign type, bid strategy, and success metrics).
- **Target audience and its size:** who they are, their intent signal, and the number the platform's audience tool shows (the audience sizer needs that number; it will not guess it).
- **Budget and expected CPM/CPC:** daily or monthly spend and the costs from your own account (drives budget fit and bid strategy).
- **Targets:** target CPA, target ROAS, gross margin (the calculator judges metrics only against these).
- **Conversion action and offer:** the action you pay for and the offer behind it (drives structure, tracking and ad-to-page match).
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
---
## Quick Start
### Launch a Campaign
1. Define the campaign goal (leads, sales, traffic, awareness).
2. Select the platform by audience and intent (decision tree in `references/campaign-playbook.md`).
3. Set up conversion tracking and verify it with a test conversion.
4. Build the targeting in the platform, read its audience estimate, and run `audience_sizer.py` with that estimate, your daily budget and your CPM.
5. Write the ads and run `ad_copy_scorer.py` until it prints `PASS`.
6. Set budget and bid strategy; launch and leave it for the learning phase before changing anything.
### Optimize an Existing Campaign
1. Export the last 14-30 days (spend, impressions, clicks, conversions, revenue).
2. Run `cpc_calculator.py` with your target CPA / ROAS / gross margin.
3. Act on the top finding first: each one gives the CVR, CPC or spend level that would hit your target.
4. Make one change at a time and document it.
---
## Tools
All four read your input (a JSON file, positional or `--input`/`--file`, or flags), take
`--format text|json` (`--json` is an alias), and use only the Python standard library.
### 1. Audience Sizer (`scripts/audience_sizer.py`)
Sizes an audience only from numbers you supply and shows each step. Two sources:
`platform_estimate` (what the ad platform's audience tool shows) or `base_population` times
filter shares you give. With neither, the size is reported as **UNKNOWN** and the tool exits 1.
With `daily_budget` and `cpm` it computes impressions per person per week and flags an audience
too small for the budget (saturation) or a budget too thin for the audience, with the exact budget
or audience size that fixes it. Frequency thresholds are labelled heuristics; the LinkedIn 300-member
minimum is cited.
```bash
python3 scripts/audience_sizer.py assets/sample_audience.json
python3 scripts/audience_sizer.py --platform linkedin --platform-estimate 38000 --daily-budget 500 --cpm 48
python3 scripts/audience_sizer.py --base 120000 --filter "dental labs=40" --filter "200-1000 staff=25"
python3 scripts/audience_sizer.py assets/flawed_audience.json --format json
```
Usage: `audience_sizer.py [input.json] [--input FILE] [--platform P] [--targeting TEXT] [--platform-estimate N] [--base N] [--filter NAME=PCT ...] [--daily-budget X] [--cpm X] [--flight-days N] [--format text|json] [--json]`
### 2. CPC / CPA / ROAS Calculator (`scripts/cpc_calculator.py`)
Computes CPC, CPM, CTR, CVR, CPA, CPL and ROAS from your numbers. A metric whose inputs are
missing is listed as "not computed", never as 0. Judges only against your `target_cpa`,
`target_roas` and `gross_margin_pct` (break-even ROAS = 1 / margin). Each finding gives the
CVR, CPC, revenue or spend that would hit the target. Ships no industry benchmark table.
```bash
python3 scripts/cpc_calculator.py assets/sample_campaigns.json
python3 scripts/cpc_calculator.py --spend 5000 --clicks 1200 --conversions 45 --revenue 12000 --target-cpa 120 --gross-margin-pct 60
python3 scripts/cpc_calculator.py assets/flawed_campaigns.json --format json
```
Usage: `cpc_calculator.py [input.json] [--input FILE] [--name N] [--platform P] [--spend X] [--impressions N] [--clicks N] [--conversions N] [--revenue X] [--leads N] [--target-cpa X] [--target-roas X] [--gross-margin-pct X] [--format text|json] [--json]`
### 3. Ad Copy Checker (`scripts/ad_copy_scorer.py`)
Checks headlines, descriptions and CTA against documented platform specs (Google RSA 30/90
character limits and 3-15 headline / 2-4 description counts; Meta, LinkedIn, TikTok and X
lengths) and editorial rules (Google capitalisation, punctuation, exclamation in headlines,
unverified superlatives; Meta personal attributes). Also flags gibberish and placeholder text,
filler words, duplicates, copy with no number, and generic CTAs. No score: every finding quotes the
line, cites its source or says "heuristic", and gives a rewrite built from your own words.
```bash
python3 scripts/ad_copy_scorer.py assets/sample_ads.json
python3 scripts/ad_copy_scorer.py --platform google --headline "Payroll for UK Restaurants" --headline "Run Payroll in 10 Minutes" --headline "From 4 GBP per Employee" --description "Run payroll for 50 staff in 10 minutes." --description "RTI filing built in. 30-day trial."
python3 scripts/ad_copy_scorer.py assets/flawed_ads.json --format json
```
Usage: `ad_copy_scorer.py [input.json] [--input FILE] [--platform google|meta|linkedin|tiktok|x] [--headline TEXT ...] [--description TEXT ...] [--cta TEXT] [--format text|json] [--json]`
### 4. LinkedIn Ads Checker (`scripts/linkedin_ads_checker.py`)
Reads a LinkedIn campaign/ad export (JSON or CSV) and checks each ad against LinkedIn's published
limits: intro text, headline and description length per format (hard limit vs the length where
the feed cuts the text off), CTA button names, the 300-member audience minimum, the minimum daily
budget, and objective/format fit. Performance (CTR, CPC, CPA) is judged only against YOUR baseline,
and only once the ad has enough impressions or clicks. Missing fields are listed as "not computed".
The limits live in `references/linkedin-ad-specs.json` with the source named; override any of them
with `--limits FILE` and re-check LinkedIn's current ad specs before a large launch.
```bash
python3 scripts/linkedin_ads_checker.py assets/sample_linkedin_ads.json
python3 scripts/linkedin_ads_checker.py export.csv --baseline-ctr 0.55 --baseline-cpa 140
python3 scripts/linkedin_ads_checker.py assets/flawed_linkedin_ads.json --format json
```
Usage: `linkedin_ads_checker.py [input.json|input.csv] [--input FILE] [--limits FILE] [--baseline-ctr PCT] [--baseline-cpc X] [--baseline-cpa X] [--demo] [--format text|json] [--json]`
Input shapes for all four are documented in each script's `--help` and shown in `assets/`.
---
## LinkedIn Ads
LinkedIn targets by job title, seniority and company, so audiences are small and the checks differ from Google or Meta.
**Workflow: launch a LinkedIn campaign**
1. Pick the objective first; it decides which formats are available (`objective_formats` in the spec file).
2. Build the targeting, read the audience estimate, and run `audience_sizer.py --platform linkedin` for budget fit.
3. Put the hook and offer in the first 150 characters of the intro text (the spec file's recommended length; longer text may be cut off in the feed).
4. Export or write the ads as JSON/CSV and run `linkedin_ads_checker.py` until it prints `PASS`.
**Workflow: judge a running campaign**
1. Export 14-30 days per ad with impressions, clicks, conversions, spend and frequency.
2. Run `linkedin_ads_checker.py export.csv --baseline-ctr N --baseline-cpa N` with numbers from your own account.
3. Fix the top finding only; rerun after a full learning period.
**Most damaging mistakes**
- Launching with an audience under the 300-member floor, or so small for your budget that frequency passes the 5 ceiling (internal heuristic).
- Pairing an objective with a format it does not offer (for example video views with a static image).
- Burying the offer after the recommended 150 characters of intro text.
- Judging an ad on a handful of clicks; the checker waits for enough impressions or clicks, so do you.
- Comparing with an industry benchmark instead of your own baseline.
---
## Exit Codes
| Code | Meaning |
|------|---------|
| `0` | Clean: size known and budget fits / every judged metric meets its target / no copy findings. Text output starts with `PASS`. |
| `1` | Findings to act on (including audience size UNKNOWN). Text output starts with `FIX n issues`. |
| `2` | Unusable input: missing or unreadable file, invalid JSON, negative numbers, a filter share over 100%, clicks above impressions, an ad with no text. One `BLOCKED:` line on stderr, no traceback. |
Samples: `assets/sample_*.json` (exit 0), `assets/flawed_*.json` (exit 1), `assets/malformed_*.json`
(exit 2), plus `assets/unsized_audience.json` (exit 1, size UNKNOWN). `assets/contract.json` declares
every run.
---
## Example Run
```bash
python3 scripts/audience_sizer.py assets/flawed_audience.json
```
```
FIX 2 issues
Read: platform=linkedin, targeting='Heads of procurement at mid-market dental labs in US', filters=2, platform_estimate=given, base=given, budget=given, cpm=given
Audience size: 9,000 (platform estimate)
Arithmetic:
base population (yours) = 2,000,000
2,000,000 x 20% (procurement function) = 400,000
400,000 x 10% (dental labs) = 40,000
assumes the filters are independent; overlapping filters make the true size larger
platform estimate (yours, from the LinkedIn Campaign Manager audience estimate) = 9,000
daily impressions = $400.00 / $40.00 CPM x 1000 = 10,000
impressions per person per week = 10,000 x 7 / 9,000 = 7.78
flight impressions = 10,000 x 30 days = 300,000
Findings:
1. [estimates-disagree] "platform estimate 9,000 vs your arithmetic 40,000"
The two sizes differ by 4.4x (heuristic threshold 3x). ...
2. [audience-too-small-for-budget] "$400.00/day at $40.00 CPM into 9,000 people"
7.8 impressions per person per week (heuristic ceiling 5). ...
Fix: Cut the daily budget to $102.86 (= 2 x 9,000 / 7 x $40.00 / 1000), or broaden the audience to about 35,000.
```
Same tool family for LinkedIn exports:
```bash
python3 scripts/linkedin_ads_checker.py assets/flawed_linkedin_ads.json --baseline-ctr 0.5
```
```
FIX 13 issues
Read: 2 ad(s) from assets/flawed_linkedin_ads.json; limits from linkedin-ad-specs.json
Northwind Payroll - overlong: ctr_pct=0.30, cpc=12.00, cpa=900.00
Northwind Payroll - text ad: ctr_pct=not computed, cpc=not computed, cpa=not computed; missing: clicks
Findings:
1. [text-over-limit] Northwind Payroll - overlong: intro_text 3041 chars: "Our revolutionary platform transforms how every finance team..."
Rule: single_image intro text allows 3000 characters. Source: LinkedIn Marketing Solutions ad specs, checked 2026-12-03; verify current specs.
Fix: Cut 41 characters; keep the claim and the number, drop the lead-in.
...
6. [objective-format-mismatch] Northwind Payroll - overlong: objective "video views" with format "single image"
Fix: Use one of: video, or change the objective.
```
---
## Campaign Playbook
The long-form strategy lives in [`references/campaign-playbook.md`](references/campaign-playbook.md):
platform selection and decision tree, account structure and naming, targeting options per platform,
automated campaign types (Performance Max, Advantage+, Demand Gen), budget allocation by phase and
scaling rules, bid strategy ladder, retargeting windows and exclusions, the optimization decision
tree, creative fatigue signals, weekly routine, attribution and UTM standards.
The cost, budget and benchmark figures in that file are directional heuristics, not sourced
statistics. Use your own account data as targets and feed it to the scripts.
---
## Pre-Launch Checklist
### Tracking
- [ ] Pixel/tag installed and firing correctly
- [ ] Conversion events defined and tested with a real test conversion
- [ ] UTM parameters added to all ad destination URLs
- [ ] GA4 goals/events configured to match conversion events
- [ ] Attribution window set and documented (e.g., Meta: 7-day click + 1-day view; the 7-/28-day view windows no longer exist)
### Landing Page
- [ ] Page loads fast on mobile and is responsive
- [ ] Headline matches the ad message
- [ ] CTA is above the fold on mobile
- [ ] Form works and submits to the CRM/email system
- [ ] Thank-you page/event fires conversion tracking
### Campaign Setup
- [ ] Budget set correctly (daily or lifetime)
- [ ] Bid strategy selected and configured
- [ ] Audience estimate read from the platform and checked with `audience_sizer.py` (budget fit)
- [ ] Negative keywords added (Google Search)
- [ ] Exclusions configured (existing customers, competitors)
- [ ] Ad schedule, geography and devices verified
### Creative
- [ ] 3+ creative variants per ad group/set
- [ ] `ad_copy_scorer.py` prints `PASS` for every ad
- [ ] Landing page URL correct for each ad
---
## Best Practices
1. **Tracking first, creative second.** Never launch without verified conversion tracking.
2. **Start narrow, expand gradually.** Begin with the highest-intent audience; expand after the funnel works.
3. **One change at a time.** Changing audience, creative and bid together hides what worked.
4. **Respect the learning phase.** Do not judge a campaign before the platform's learning phase ends.
5. **Creative is the biggest lever** on most platforms; test it before re-slicing targeting.
6. **Match ad to landing page.** Mismatched expectations kill post-click conversion.
7. **Concentrate budget.** Prove one platform before spreading thin across several.
8. **Build retargeting audiences from day one,** even before you spend on retargeting.
9. **Check platform data against your CRM/GA4.** Platform-reported conversions run higher than what the CRM records.
10. **Document every change** and its result.
---
## Troubleshooting
| Symptom | Likely Cause | Fix |
|---------|-------------|-----|
| CPA above target with low CTR | Creative fatigue or audience mismatch | Refresh creative; run `ad_copy_scorer.py` on the new copy. |
| CPA above target with good CTR | Landing page conversion issue | `cpc_calculator.py` gives the CVR you need; audit message match, speed and form friction. |
| CTR dropping week over week | Creative fatigue / high frequency | Run `audience_sizer.py` with your budget and CPM; it gives the budget or audience size for about 2 impressions per person per week. |
| Budget not spending | Audience too narrow or bid too low | Check the platform estimate with `audience_sizer.py`; raise bid or widen targeting. |
| Platform reports inflated conversions | Attribution window too wide | Compare to GA4/CRM; use incrementality testing for true lift. |
| Performance Max underperforming | Too little or low-quality conversion data | Build conversion volume first (start with Search), optimize to a revenue-linked conversion, add brand exclusions and negatives. |
| CPA spikes after budget increase | Learning disrupted | Increase budget in small steps and wait several days between changes. |
| Audience size shows UNKNOWN | No number was supplied | Read the estimate in the ad platform and pass `--platform-estimate`. |
---
## Integration Points
- **Ad Creative**: writing ad copy and variations. Paid Ads handles strategy and checks the copy.
- **Landing Page Generator**: the pages ads drive traffic to.
- **Campaign Analytics**: attribution analysis and cross-channel ROI.
- **Marketing Context**: audience and messaging foundation.
- **Copywriting**: landing page copy for post-click conversion.
---
## Scope & Limitations
**In scope:** campaign strategy, platform selection, audience sizing from supplied numbers, budget fit, bid strategies, retargeting, performance checks against your targets, ad copy checks, attribution, pre-launch checklists.
**Out of scope:** creative design and production, marketing automation, CRM configuration, live platform data (the scripts read exports and numbers you paste; they make no network calls).
**Limitations:** the audience sizer cannot size a text description; it needs a platform estimate or a base count. Frequency and budget-fit thresholds are heuristics. Platform specs in the copy and LinkedIn checkers are cited with the year they were checked; platforms change them, so re-check the current spec page before a large launch.