Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.
JavaScript agent-skillsai-agentsai-seoclaudeclaude-codeclaude-code-pluginclaude-skillscodexcontent-marketingconversion-rate-optimizationcopywritingcursoremail-marketinggenerative-engine-optimizationgrowth-marketingmarketingmarketing-automationsaas-marketingseoskill-md
feat: ads 2.4.0 — reading Google Ads data without false conclusions (#605)
Corey Haines323738ada516
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex aab7dd0..496dd40 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -6,7 +6,7 @@},"metadata": {"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",- "version": "2.11.1",+ "version": "2.11.2","repository": "https://github.com/coreyhaines31/marketingskills"},"plugins": [diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 8dfa1b1..44b608e 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "marketing-skills","description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",- "version": "2.11.1",+ "version": "2.11.2","author": {"name": "Corey Haines"},diff --git a/VERSIONS.md b/VERSIONS.mdindex 0e6e19c..a0539e5 100644--- a/VERSIONS.md+++ b/VERSIONS.md@@ -36,7 +36,7 @@ Current versions of all skills. Agents can compare against local versions to che| marketing-psychology | 2.0.0 | 2026-05-05 || offers | 1.0.1 | 2026-08-23 || onboarding | 2.0.1 | 2026-08-23 |-| ads | 2.3.2 | 2026-08-23 |+| ads | 2.4.0 | 2026-10-01 || paywalls | 2.0.0 | 2026-05-05 || popups | 2.0.0 | 2026-05-05 || pricing | 2.1.1 | 2026-08-23 |@@ -57,6 +57,11 @@ Current versions of all skills. Agents can compare against local versions to che## Recent Changes+### 2.11.2 (2026-10-01)++- **ads** (2.3.2 → 2.4.0): new `references/reading-google-ads-data.md`, covering how Google Ads data misleads before an audit even starts. **Search terms are a sample**: on small accounts 50–65% of clicks have no disclosed query, so every claim states disclosed vs total clicks, the report is pulled unfiltered first, and nothing (GA4, CRM) recovers the withheld queries. Data traps: `conversions` vs `all_conversions`, several final URLs per ad group, click-date attribution, expired experiment arms that look like duplicate campaigns, the 30-day change-history limit, and `client_type` for who else changes the account. **Window vs lifetime** and no pooling across config changes. **Small numbers**: a zero-conversions-in-N-clicks table (what each sample size rules out) plus break-even CVR = CPC ÷ target CPA, and "let it run" only with a date. **Stating findings** as verified / inferred / stale, the "can the client disprove this in a minute?" test, and a "conclusions that sound right" table. Fixed the `audit-guardrails.md` Fail example that treated disclosed search terms as a share of all spend. Two new evals (ids 12–13). New triggers: 'search terms report,' 'wasted spend,' 'is this campaign working.'+- **tools/google-ads**: API URLs moved from the long-sunset v14 to v24 (guide and CLI); added analysis GAQL recipes (campaign inventory, monthly since launch, conversions by action, unfiltered search terms, ads by final URL, change history) and a gotchas table. Closes #601.+### 2.11.1 (2026-09-04)- **ai-seo** (2.4.0 → 2.5.0): new `references/format-volatility.md` — the citation-*format* volatility axis, companion to agent-readiness.md's citation-*source* volatility. Anchored on the **ChatGPT 5.6 format shift** (Aug 2026, Peec AI data via Tomek Rudzki and Lily Ray): fan-out queries dropped the "vs / comparison / top / best / reviews" modifiers while `site:` and "official" searches surged, and citations by page type fell −50.5% for listicles (15.77% → 7.80%) and −32.1% for comparison pages (9.08% → 6.17%) — the two formats companies scaled for GEO, demoted in one release. Covers what changes (stop justifying scaled listicle/comparison production with "wins AI citations"; owned "official" pages rising as the citable class) and what doesn't (comparisons still convert humans and still earn citations on Google AIO / Gemini / Perplexity — a per-platform format table replaces one-size-fits-all advice). Adds **LinkedIn as a citation surface** from LinkedIn's own AEO guide (via Chris Long, platform-reported: most-cited outlet for professional searches; Articles out-cite Posts ~60/40; first words of a post become the URL slug — front-load the target phrase), a **DIY ChatGPT fan-out extraction** diagnostic (DevTools → network payload → literal background queries; explicitly warned against as a mass-generation content-spam input), and a **measurement-rigor** section (AI answers are non-deterministic: 3–5 runs per query, mention *rate* with sample size, rates-over-time not run-vs-run, technical/comprehension/trust cause split; framing credited to Initial Commit's AEO audit skill, Josh Pigford). SKILL.md: Content Types section rewritten around the volatility (stale ~33%-comparison-share table retired to context), ChatGPT fan-out + extraction pointer added to the fan-out section, LinkedIn added to the Presence pillar, non-determinism rule added to DIY monitoring, new triggers ('do listicles still work for AI,' 'ChatGPT stopped citing comparison pages,' 'AI citation format shift'). New eval (id 10) covers the scaled-comparison-roadmap prompt that must get the 5.6 pushback plus the one-run-anecdote measurement correction.diff --git a/skills/ads/SKILL.md b/skills/ads/SKILL.mdindex 3a06fcd..36c6aa2 100644--- a/skills/ads/SKILL.md+++ b/skills/ads/SKILL.md@@ -1,8 +1,8 @@---name: ads-description: "When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,' 'LinkedIn ads,' 'ad budget,' 'cost per click,' 'ad spend,' 'should I run ads,' 'ABM,' 'account-based marketing,' 'B2B ads,' 'lead quality,' 'negative keywords,' 'Performance Max,' 'thought leader ads,' or 'when should I kill an ad.' Use this for campaign strategy, audience targeting, bidding, and optimization. For bulk ad creative generation and iteration, see ad-creative. For landing page optimization, see cro."+description: "When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,' 'LinkedIn ads,' 'ad budget,' 'cost per click,' 'ad spend,' 'should I run ads,' 'ABM,' 'account-based marketing,' 'B2B ads,' 'lead quality,' 'negative keywords,' 'Performance Max,' 'thought leader ads,' 'when should I kill an ad,' 'search terms report,' 'wasted spend,' or 'is this campaign working.' Use this for campaign strategy, audience targeting, bidding, and optimization. For bulk ad creative generation and iteration, see ad-creative. For landing page optimization, see cro."metadata:- version: 2.3.2+ version: 2.4.0---# Paid Ads@@ -54,6 +54,7 @@ This skill's depth lives in references — load by intent. For **any operational| Named-account targeting, pipeline acceleration, cross-channel retargeting | [abm-playbook.md](references/abm-playbook.md) | LinkedIn/Meta ABM, list mechanics, acceleration campaigns, UTM cross-channel remarketing, ABM measurement || Generating Google RSAs | [rsa-output-spec.md](references/rsa-output-spec.md) | Mandatory output spec — limits, sidecars, template, self-check || Auditing a live account, grading account health, quoting benchmarks, recommending changes | [audit-guardrails.md](references/audit-guardrails.md) | Pass/fail/unknown scoring, evidence coverage, recommendation safety, hard stops, benchmark discipline |+| Analyzing or reporting on Google Ads data, search-term waste, pause/keep/scale on low volume, client-facing findings | [reading-google-ads-data.md](references/reading-google-ads-data.md) | Withheld search terms (disclosed vs total clicks), conversions vs all_conversions, click-date attribution, experiment arms, 30-day change history, zero-in-N table, break-even CVR, verified/inferred/stale, "conclusions that sound right" || Itemized Google Ads / ecommerce account audit (Search + Shopping + PMax + GMC + Demand Gen) | [google-ads-audit-checklist.md](references/google-ads-audit-checklist.md) | 32 checks across 11 categories — feed/GMC quality, Shopping segmentation, PMax signals/budget, DG format splits, lander funnels; each scored pass/fail/unknown/NA via audit-guardrails || Agentic creative/competitive research: ad-library teardown, review→persona mapping, organic competitor teardown | [creative-research-automation.md](references/creative-research-automation.md) | Ad Library output schema (format split, % partnership, inferred personas, top-10 by impressions), reviews→CSV→personas doc→deck, "who creatives target vs. who buys," connectors + scheduled-to-Slack workflow || Audience setup, tracking setup, launch checklists, copy formulas | [audience-targeting.md](references/audience-targeting.md) · [conversion-tracking.md](references/conversion-tracking.md) · [platform-setup-checklists.md](references/platform-setup-checklists.md) · [ad-copy-templates.md](references/ad-copy-templates.md) | Existing foundations |@@ -431,6 +432,7 @@ When the user requests Google Ads RSAs, load [references/rsa-output-spec.md](refBefore auditing a live account, grading account health, quoting benchmarks, or recommending changes to running campaigns, load [audit-guardrails.md](references/audit-guardrails.md). The non-negotiables:- **Unknown ≠ failing.** Score only what you verified. "Couldn't check X" and "X is broken" are different findings — and never call an audit complete when a data source failed.+- **Search terms are a sample; small numbers prove little.** State disclosed vs total clicks, and compute break-even CVR before calling spend wasted. See [reading-google-ads-data.md](references/reading-google-ads-data.md).- **No invented negative keywords.** Without a search-terms report, request it — name zero candidates.- **Never sum conversions across attribution windows.** Meta 7-day + Google 30-day is not a total; report them side by side.- **No fixed kill rules.** A CPA spike is a question, not a verdict — check sample size, conversion lag, and learning phase before pausing anything.@@ -442,7 +444,7 @@ Before auditing a live account, grading account health, quoting benchmarks, or r### Strategy- Launching without conversion tracking- Too many campaigns (fragmenting budget)-- Not giving algorithms enough learning time+- Not giving algorithms enough learning time, or stopping campaigns mid-learning phase- Optimizing for wrong metric### Targeting@@ -458,7 +460,6 @@ Before auditing a live account, grading account health, quoting benchmarks, or r### Budget- Spreading too thin across campaigns- Making big budget changes (disrupts learning)-- Stopping campaigns during learning phase---@@ -495,5 +496,4 @@ For tracking setup, see [references/conversion-tracking.md](references/conversio- **customer-research / competitor-profiling / positioning**: Voice-of-customer that feeds ad copy and angles; and turning an organic-teardown shortlist + the personas doc from [creative-research-automation.md](references/creative-research-automation.md) into full competitor dossiers and positioning- **copywriting**: For landing page copy that converts ad traffic- **analytics / attribution**: Conversion tracking setup and the blended-CAC inputs behind [payback-period.md](references/payback-period.md); **pricing** sets the ARPU + plan structure that drive its Payback math (why blended LTV:CAC hides $9-vs-$999 variance)-- **ab-testing**: For landing page testing to improve ROAS-- **cro**: For optimizing post-click conversion rates+- **ab-testing / cro**: For landing page tests and post-click conversion rates that improve ROASdiff --git a/skills/ads/evals/evals.json b/skills/ads/evals/evals.jsonindex f4a2ff6..3632c2a 100644--- a/skills/ads/evals/evals.json+++ b/skills/ads/evals/evals.json@@ -152,6 +152,30 @@"Recommends not running paid for the unaffordable starter plan / routing it elsewhere","Mentions Discounted Payback Period (retention-adjusted)"]+ },+ {+ "id": 12,+ "prompt": "Here's our Google Ads search terms report for the last 30 days on our main campaign. The campaign had 33 clicks total. The terms below add up to 13 clicks and most look irrelevant \u2014 'free invoice template', 'invoice meaning', etc. Write me a note to the client saying the campaign is mostly buying junk traffic and we're wasting their money.",+ "expected_output": "Should load references/reading-google-ads-data.md. Should point out that the report discloses only 13 of 33 clicks (~39%) and the remaining 20 have no visible query, so 'mostly junk' is not supported; the disclosed terms are a non-random sample skewed toward common queries. Should note that no analytics tool recovers the withheld queries, but GA4/CRM can show what all sessions did. Should check sample size before calling spend wasted (break-even CVR = CPC / target CPA). Should draft a client note that states the disclosed-vs-total ratio up front and frames the irrelevant terms as candidates for negatives after an overblocking review, not as proof the campaign is wasting money.",+ "assertions": [+ "States the disclosed vs total clicks ratio (13 of 33)",+ "Explains Google withholds low-volume search terms and they cannot be recovered from site analytics",+ "Does not write a client note claiming the campaign is 'mostly' junk traffic",+ "Mentions sample size or break-even CVR before calling the spend wasted",+ "Client-facing draft volunteers the data limits rather than hiding them"+ ]+ },+ {+ "id": 13,+ "prompt": "Our non-brand Google campaign has 0 conversions from 48 clicks this month at a $6 CPC. Our target CPA is $150. My boss wants to pause it. Is it failing?",+ "expected_output": "Should load references/reading-google-ads-data.md. Should explain that zero conversions in ~50 clicks only rules out conversion rates of roughly 6% or higher at 95% confidence. Should compute break-even CVR = $6 / $150 = 4%, which is below what 48 clicks can rule out, so the campaign is unmeasured rather than proven failing. Should estimate how long a readable sample takes at current volume (~100 clicks to judge a 3-4% CVR, so roughly another month) and recommend a dated decision point instead of 'let it run' indefinitely. Should also ask/check how long the campaign has run, whether config changed mid-window, whether the bid strategy is in learning, and which conversion actions are primary.",+ "assertions": [+ "Says zero conversions in ~50 clicks only rules out CVR around 6% or higher",+ "Computes break-even CVR as CPC / target CPA = 4%",+ "Concludes the campaign is unmeasured rather than proven failing",+ "Gives a dated or volume-based decision point rather than an open-ended 'let it run'",+ "Checks at least one of: runtime/lifetime window, mid-window config changes, learning status, conversion action definitions"+ ]}]}diff --git a/skills/ads/references/audit-guardrails.md b/skills/ads/references/audit-guardrails.mdindex e68aee7..7f3c3b3 100644--- a/skills/ads/references/audit-guardrails.md+++ b/skills/ads/references/audit-guardrails.md@@ -9,7 +9,7 @@ Every check in an audit resolves to exactly one of four results:| Result | Meaning | Example ||---|---|---|| **Pass** | You saw the evidence and it's right | Conversion tracking fired on a test conversion you observed |-| **Fail** | You saw the evidence and it's wrong | Search terms report shows 40% of spend on irrelevant queries |+| **Fail** | You saw the evidence and it's wrong | Search terms report shows clearly irrelevant queries taking a large share of *disclosed* clicks || **Unknown** | The evidence needed to judge this wasn't available | No access to the search terms report || **Not applicable** | This check doesn't apply to the account | PMax checks on an account that doesn't run PMax |diff --git a/skills/ads/references/reading-google-ads-data.md b/skills/ads/references/reading-google-ads-data.mdnew file mode 100644index 0000000..7bd1a5b--- /dev/null+++ b/skills/ads/references/reading-google-ads-data.md@@ -0,0 +1,121 @@+# Reading Google Ads Data Without False Conclusions++Load this before analyzing, auditing, or reporting on a Google Ads account, or before deciding whether to pause, keep, or scale anything in one. [audit-guardrails.md](audit-guardrails.md) covers how to *grade* what you find. This file covers how the data *misleads* you before you get that far.++Google Ads reports are partial by design and plausible by accident. Default views omit data without saying so, resource names suggest contents they don't have, and small accounts produce numbers that look like findings. Most wrong conclusions come from not knowing that, not from bad reasoning.++Query patterns and API gotchas live in [google-ads.md](../../../tools/integrations/google-ads.md).++## What the data hides++### Search terms are a sample, not the total++Google withholds any query searched by too few people. On low-volume accounts, **50–65% of clicks routinely have no disclosed search term.** The visible terms are a non-random sample skewed toward common searches.++- Any claim about "what this campaign is buying" carries the ratio: *of the 13 clicks Google discloses, out of 33 total.*+- Pull the report **unfiltered first**. Filtering by `clicks > 0` also drops every impression-only term, and combined with a low `LIMIT` it hides most of the picture.+- **Nothing recovers the withheld queries.** The query is never passed to the site, so GA4, PostHog, or a CRM can show what every session *did* (joined on gclid), never what was *typed*.++```+disclosed clicks = SUM(clicks in the search terms report)+total clicks = campaign clicks for the same window+withheld = total - disclosed+```++### Names describe intentions, not contents++An ad group called "Competitor - Commercial" can hold entirely informational keywords. A campaign named for one theme can target another. Read the keyword list and the search terms; treat every name as a label someone typed once.++### "Conversions" is several things in one column++`metrics.conversions` counts only actions marked primary. `metrics.all_conversions` adds secondary ones. One campaign's conversions might mix a page-view proxy, a trial signup, and a booked demo.++- Segment by conversion action before calling anything a lead or a demo.+- Check each action's attribution model and click window while you're there.+- Data-driven attribution runs on low volume too, but with few conversions its individual credit assignments are soft. Don't read much into one campaign's share.++### One ad group can send traffic to several pages++Ads carry their own final URLs, and stale pages linger in rotation long after a new landing page ships. Before concluding anything about landing page performance, check which destinations are serving and how traffic splits between them.++### Dates are click dates++Conversions are attributed back to the originating click. A conversion recorded today can appear dated a week earlier. When a client says "we got a conversion today" and your pull says the 11th, both are right. Say "clicked on the 11th."++### Identical campaign names are usually experiment arms++Expired experiment arms inherit the base campaign's name and can keep an ENABLED status while serving nothing. Check `campaign.experiment_type` and `campaign.serving_status` before believing a duplicate exists.++### Change history only goes back 30 days++Anything older is invisible through the API. A performance shift three months ago may have no recoverable explanation, so say that instead of guessing one.++### Other people are changing the account++Client staff, automated rules, scripts, and agents all leave changes. In `change_event`, `client_type` tells them apart: `GOOGLE_ADS_WEB_CLIENT` is a human in the UI, `GOOGLE_ADS_API` is an API integration or agent, `GOOGLE_ADS_SCRIPTS` and `GOOGLE_ADS_AUTOMATED_RULE` are scheduled automation, `GOOGLE_ADS_EDITOR` and `GOOGLE_ADS_BULK_UPLOAD` are batch edits, `GOOGLE_ADS_RECOMMENDATIONS` is an applied recommendation, and `INTERNAL_TOOL` is mostly Google's own automated asset generation. Check the enum for others. A repeating weekday-and-time pattern under one user is a scheduled job, not a person.++## The window is not the picture++A 30-day pull on a campaign that has run since spring is a slice of a longer series. Recent CPA can differ sharply from lifetime CPA.++- **Establish how long something has run** before quoting any efficiency number. Quote both recent and lifetime when they diverge.+- **Don't pool across configuration changes.** If bids, keywords, budget, ads, or targeting changed mid-window, the period is several experiments averaged together.+- **Bid-only changes are a special case.** They invalidate cost and volume comparisons but leave intent and audience questions readable.+- **Bid strategies in learning are unreadable.** `primary_status = LEARNING` means don't judge performance and don't change anything.++## Small numbers++Most false findings in small accounts are sample-size errors that look like insight. Skepticism runs both ways: one conversion on one click proves no more than zero conversions on five clicks disproves.++Zero conversions in N clicks only rules out conversion rates at or above (95% confidence):++| Clicks | Rules out CVR ≥ | What you can say |+|---|---|---|+| 5 | 45% | Nothing. Zero is the expected outcome |+| 10 | 26% | Still nothing useful |+| 30 | 10% | Can begin doubting a strong CVR |+| 50 | 6% | Meaningful for high-intent search |+| 100 | 3% | Underperforming if break-even CVR is above 3% |++Before calling spend wasted, work out what it would have to convert at to be worth keeping:++```+break-even CVR = CPC ÷ target CPA+```++If break-even CVR is below the plausible range for that traffic, the term isn't failing, it's unmeasured. Then estimate how long a readable sample takes at current click volume. "Let it run" is only an honest answer when it comes with a date you'll actually know by. At five clicks a month, sometimes the honest answer is that you never will.++## Documents describe a day; accounts move++Audits, status docs, and proposals were true when written. Every performance number in them is stale until re-pulled. The claims most likely to be repeated confidently ("zero conversions," "wasted spend," "wrong intent") are exactly the ones that change. Carry the date with the claim: *as of the audit on the 2nd*.++## Stating findings++Know which of these each claim is:++- **Verified**: pulled live this session, unfiltered, and reconciled against a total+- **Inferred**: reasoned from verified data, could be wrong+- **Stale**: from a document, an earlier session, or the client, with its date attached++Keep stale claims out of client-facing sentences unless they're labeled as such.++**The test before anything reaches a client: can they disprove this in a minute with their own account access?** They have the same reports. Volunteer the limits first (the disclosed-clicks ratio, the sample size, the config changes). It costs nothing, since they'd find them anyway, and it's what makes the rest credible.++If a claim touches a landing page, open it. Don't characterize a page from its URL, a status doc, or what the client says is on it. Calendar embeds and chat widgets load via JavaScript and won't show in a static fetch, so absence there isn't evidence.++When a client challenges a finding and they're right, concede the substance plainly and move on. Stacked retractions cost more credibility than the original error.++## Conclusions that sound right++| Sounds like | Usually |+|---|---|+| "This campaign has zero conversions" | True on the day the doc was written |+| "The search terms are junk" | You're seeing ~40% of the clicks |+| "That ad group is wrong-intent" | It's *named* that; the keywords say otherwise |+| "$X wasted on those terms" | Below any readable sample size |+| "It converted, so the term works" | One conversion on one click is noise |+| "Performance declined in August" | Bids changed three times that month |+| "Traffic lands on the new page" | Two ads serve; one points at the old page |+| "It got a demo" | It got a conversion; check which action |+| "There are duplicate campaigns" | Expired experiment arms with the base name |+| "Nobody touched it last quarter" | Change history only covers 30 days |diff --git a/tools/clis/google-ads.js b/tools/clis/google-ads.jsindex 81c35a4..0630338 100755--- a/tools/clis/google-ads.js+++ b/tools/clis/google-ads.js@@ -3,7 +3,7 @@const TOKEN = process.env.GOOGLE_ADS_TOKENconst DEV_TOKEN = process.env.GOOGLE_ADS_DEVELOPER_TOKENconst CUSTOMER_ID = process.env.GOOGLE_ADS_CUSTOMER_ID-const BASE_URL = 'https://googleads.googleapis.com/v14'+const BASE_URL = 'https://googleads.googleapis.com/v24'if (!TOKEN || !DEV_TOKEN || !CUSTOMER_ID) {console.error(JSON.stringify({ error: 'GOOGLE_ADS_TOKEN, GOOGLE_ADS_DEVELOPER_TOKEN, and GOOGLE_ADS_CUSTOMER_ID environment variables required' }))@@ -35,6 +35,8 @@ async function gaql(query) {return api('POST', `/customers/${CUSTOMER_ID}/googleAds:searchStream`, { query })}+const BOOLEAN_FLAGS = ['dry-run']+function parseArgs(args) {const result = { _: [] }for (let i = 0; i < args.length; i++) {@@ -42,7 +44,7 @@ function parseArgs(args) {if (arg.startsWith('--')) {const key = arg.slice(2)const next = args[i + 1]- if (next && !next.startsWith('--')) {+ if (!BOOLEAN_FLAGS.includes(key) && next && !next.startsWith('--')) {result[key] = nexti++} else {@@ -58,13 +60,15 @@ function parseArgs(args) {const args = parseArgs(process.argv.slice(2))const [cmd, sub, ...rest] = args._-function daysToDateRange(days) {+function dateFilter(days) {const d = parseInt(days) || 30- if (d === 7) return 'LAST_7_DAYS'- if (d === 14) return 'LAST_14_DAYS'- if (d === 30) return 'LAST_30_DAYS'- if (d === 90) return 'LAST_90_DAYS'- return `LAST_${d}_DAYS`+ if ([7, 14, 30].includes(d)) return `segments.date DURING LAST_${d}_DAYS`+ const fmt = (date) => date.toISOString().slice(0, 10)+ const end = new Date()+ end.setDate(end.getDate() - 1)+ const start = new Date(end)+ start.setDate(start.getDate() - (d - 1))+ return `segments.date BETWEEN '${fmt(start)}' AND '${fmt(end)}'`}async function main() {@@ -85,8 +89,8 @@ async function main() {result = await gaql('SELECT campaign.id, campaign.name, campaign.status, campaign_budget.amount_micros FROM campaign ORDER BY campaign.id')breakcase 'performance': {- const dateRange = daysToDateRange(args.days)- result = await gaql(`SELECT campaign.name, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING ${dateRange}`)+ const dateWhere = dateFilter(args.days)+ result = await gaql(`SELECT campaign.name, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM campaign WHERE ${dateWhere}`)break}case 'pause': {@@ -123,9 +127,9 @@ async function main() {case 'adgroups':switch (sub) {case 'performance': {- const dateRange = daysToDateRange(args.days)+ const dateWhere = dateFilter(args.days)const limit = args.limit ? ` LIMIT ${args.limit}` : ''- result = await gaql(`SELECT ad_group.name, metrics.impressions, metrics.clicks, metrics.conversions FROM ad_group WHERE segments.date DURING ${dateRange}${limit}`)+ result = await gaql(`SELECT ad_group.name, metrics.impressions, metrics.clicks, metrics.conversions FROM ad_group WHERE ${dateWhere}${limit}`)break}default:@@ -136,9 +140,9 @@ async function main() {case 'keywords':switch (sub) {case 'performance': {- const dateRange = daysToDateRange(args.days)+ const dateWhere = dateFilter(args.days)const limit = args.limit || '50'- result = await gaql(`SELECT ad_group_criterion.keyword.text, metrics.impressions, metrics.clicks, metrics.average_cpc FROM keyword_view WHERE segments.date DURING ${dateRange} ORDER BY metrics.clicks DESC LIMIT ${limit}`)+ result = await gaql(`SELECT ad_group_criterion.keyword.text, metrics.impressions, metrics.clicks, metrics.average_cpc FROM keyword_view WHERE ${dateWhere} ORDER BY metrics.clicks DESC LIMIT ${limit}`)break}default:diff --git a/tools/integrations/google-ads.md b/tools/integrations/google-ads.mdindex 7256fcf..e1e01ca 100644--- a/tools/integrations/google-ads.md+++ b/tools/integrations/google-ads.md@@ -23,7 +23,7 @@ Pay-per-click advertising platform for search, display, and video campaigns.### Get account info```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:searchStream+POST https://googleads.googleapis.com/v24/customers/{customer_id}/googleAds:searchStream{"query": "SELECT customer.id, customer.descriptive_name FROM customer"@@ -33,7 +33,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:sear### List campaigns```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:searchStream+POST https://googleads.googleapis.com/v24/customers/{customer_id}/googleAds:searchStream{"query": "SELECT campaign.id, campaign.name, campaign.status, campaign_budget.amount_micros FROM campaign ORDER BY campaign.id"@@ -43,7 +43,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:sear### Get campaign performance```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:searchStream+POST https://googleads.googleapis.com/v24/customers/{customer_id}/googleAds:searchStream{"query": "SELECT campaign.name, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS"@@ -53,7 +53,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:sear### Get ad group performance```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:searchStream+POST https://googleads.googleapis.com/v24/customers/{customer_id}/googleAds:searchStream{"query": "SELECT ad_group.name, metrics.impressions, metrics.clicks, metrics.conversions FROM ad_group WHERE segments.date DURING LAST_7_DAYS"@@ -63,7 +63,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:sear### Get keyword performance```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:searchStream+POST https://googleads.googleapis.com/v24/customers/{customer_id}/googleAds:searchStream{"query": "SELECT ad_group_criterion.keyword.text, metrics.impressions, metrics.clicks, metrics.average_cpc FROM keyword_view WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.clicks DESC LIMIT 50"@@ -73,7 +73,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/googleAds:sear### Pause campaign```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/campaigns:mutate+POST https://googleads.googleapis.com/v24/customers/{customer_id}/campaigns:mutate{"operations": [{@@ -89,7 +89,7 @@ POST https://googleads.googleapis.com/v14/customers/{customer_id}/campaigns:muta### Update budget```bash-POST https://googleads.googleapis.com/v14/customers/{customer_id}/campaignBudgets:mutate+POST https://googleads.googleapis.com/v24/customers/{customer_id}/campaignBudgets:mutate{"operations": [{@@ -139,6 +139,92 @@ ORDER BY metrics.conversions DESCLIMIT 10```+### Analysis recipes++Baseline queries for reading an account honestly. See the ads skill's `references/reading-google-ads-data.md` for why each matters.++**Campaign inventory** (separates real campaigns from expired experiment arms and learning bid strategies):++```sql+SELECT campaign.id, campaign.name, campaign.status, campaign.serving_status,+ campaign.primary_status, campaign.primary_status_reasons,+ campaign.experiment_type, campaign.bidding_strategy_type+FROM campaign+WHERE campaign.status != 'REMOVED'+```++**Monthly performance since launch** (only months with activity come back, so the first row is the first month with spend; run before quoting any CPA):++```sql+SELECT segments.month, metrics.impressions, metrics.clicks,+ metrics.cost_micros, metrics.conversions+FROM campaign+WHERE campaign.id = <ID>+ AND segments.date BETWEEN '<EARLY_DATE>' AND '<TODAY>'+ORDER BY segments.month+```++**Conversions by action** (primary vs secondary):++```sql+SELECT segments.conversion_action_name, segments.conversion_action_category,+ metrics.conversions, metrics.all_conversions+FROM campaign+WHERE campaign.id = <ID>+ AND segments.date BETWEEN '<START>' AND '<END>'+ AND metrics.all_conversions > 0+```++**Search terms, unfiltered** (then reconcile disclosed clicks against campaign clicks for the same window):++```sql+SELECT search_term_view.search_term, ad_group.name, metrics.impressions,+ metrics.clicks, metrics.cost_micros, metrics.conversions+FROM search_term_view+WHERE campaign.id = <ID>+ AND segments.date BETWEEN '<START>' AND '<END>'+ORDER BY metrics.impressions DESC+LIMIT 1000+```++Raise the limit until disclosed clicks stop growing; a low limit hides the long tail.++**Ads with final URLs** (ad groups often serve several destinations):++```sql+SELECT ad_group.name, ad_group_ad.ad.id, ad_group_ad.status,+ ad_group_ad.ad.final_urls, metrics.clicks, metrics.conversions+FROM ad_group_ad+WHERE campaign.id = <ID>+ AND segments.date BETWEEN '<START>' AND '<END>'+```++**Change history** (who changed what; 30-day maximum):++```sql+SELECT change_event.change_date_time, change_event.change_resource_type,+ change_event.resource_change_operation, change_event.client_type,+ change_event.user_email, change_event.changed_fields+FROM change_event+WHERE change_event.change_date_time >= '<29_DAYS_AGO>' -- 'YYYY-MM-DD HH:MM:SS'+ AND change_event.change_date_time <= '<TOMORROW>'+ORDER BY change_event.change_date_time DESC+LIMIT 200+```++`LIMIT` is required on `change_event` and capped at 10,000.++### Gotchas++| Problem | Fix |+|---|---|+| `campaign.start_date` → `UNRECOGNIZED_FIELD` | Newer API versions use `campaign.start_date_time`; if that also fails, derive the start from the first month the monthly query returns |+| `DURING LAST_90_DAYS` → `INVALID_VALUE_WITH_DURING_OPERATOR` | Only some date literals are valid; use `segments.date BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'` |+| `change_event` → `START_DATE_TOO_OLD` | 30-day limit, strictly enforced; pad the start by a day |+| `change_event` errors with no limit | `LIMIT` is required |+| Cost looks 1,000,000x too big | `cost_micros` ÷ 1,000,000 |+| Keyword or change queries return huge payloads | Write to a file and parse; `keyword_view` returns negatives too (split on `ad_group_criterion.negative`) |+## When to Use- Managing search advertising campaigns