google-ads-scripts
Expert guidance for Google Ads Script development including AdsApp API, campaign management, ad groups, keywords, bidding strategies, performance reporting, budget management, automated rules, and optimisation patterns. Use when automating Google Ads campaigns, managing keywords and bids, creating performance reports, implementing automated rules, optimising ad spend, working with campaign budgets, monitoring quality scores, tracking conversions, pausing low-performing keywords, adjusting bids based on ROAS, or building Google Ads automation scripts. Covers campaign operations, keyword targeting, bid optimisation, conversion tracking, error handling, and JavaScript-based automation in the Google Ads scripts editor. Do NOT use for the Google Ads API (Python/REST/gRPC) - this is Ads Scripts only. Do NOT use for Microsoft Ads, Meta Ads, or other non-Google ad platforms.
What this skill does
# Google Ads Scripts
## Overview
Guidance for developing Google Ads Scripts using the AdsApp API. Automate campaign management, bid optimisation, performance reporting, and bulk operations through JavaScript running in the Google Ads editor.
## When to Use This Skill
- Automating campaign management or bulk operations
- Managing keywords and adjusting bids programmatically
- Creating performance reports or dashboards
- Implementing automated rules for campaign optimisation
- Optimising ad spend based on ROAS or CPA targets
- Monitoring quality scores, budgets, or conversions
- Debugging Google Ads Script code or API issues
## Core Capabilities
### 1. Campaign Operations
Manage campaigns programmatically - creation, modification, status changes, bulk updates. Use `AdsApp.campaigns()` with conditions to filter by status, budget, name patterns, or type. Apply labels for organisation.
### 2. Keyword & Bid Management
Automate keyword targeting and bid adjustments based on performance. Filter by quality score, adjust max CPC bids based on ROAS/CPA targets, add/remove negative keywords, and implement bid optimisation algorithms.
### 3. Performance Reporting
Generate custom reports using campaign, ad group, keyword, and ad statistics. Retrieve metrics for custom date ranges, calculate derived metrics (CTR, CPC, conversion rate), and export data to Google Sheets.
### 4. Budget Management
Control spending and allocate budgets across campaigns. Get/set daily campaign budgets, monitor spend against thresholds, pause campaigns when limits are reached, and distribute budgets based on performance.
### 5. Automated Rules & Optimisation
Build intelligence into campaign management with automated decision-making. Pause low-performing keywords, increase bids for high-performers, adjust budgets based on day-of-week patterns.
### 6. Error Handling & Resilience
Implement robust error handling for API limits, quota issues, and runtime errors. Use try-catch blocks, null checks, sheet-based logging for audit trails. Be aware of the 30-minute execution limit.
## Quick Start
The most common pattern - pause keywords with low quality scores and high spend:
```javascript
function pauseLowQualityKeywords() {
const keywords = AdsApp.keywords()
.withCondition('keyword.status = ENABLED')
.withCondition('keyword.quality_info.quality_score < 4')
.withCondition('keyword.metrics.cost > 100000000')
.get();
let count = 0;
while (keywords.hasNext()) {
keywords.next().pause();
count++;
}
Logger.log(`Paused ${count} low-quality keywords`);
}
```
## Best Practices
- **Batch operations** - collect entities first, then process; avoid individual API calls in loops
- **API-level filtering** - use `.withCondition()` instead of filtering in JavaScript
- **Error handling** - wrap operations in try-catch, log errors to sheets or email
- **Execution limits** - use `.withLimit()` and batch processing for large accounts (30-min timeout)
- **Micros conversion** - currency values are in micros (divide by 1,000,000 for display)
- **Audit logging** - log all changes to Google Sheets with timestamps
See [references/best-practices.md](references/best-practices.md) for detailed code examples of each practice.
## Integration with Other Skills
- **google-apps-script** - Use for Google Sheets reporting, Gmail notifications, Drive file management, and trigger setup
- **ga4-measurement-protocol** - Combine with GA4 for tracking script-triggered events
- **gtm-api** - Coordinate with GTM configurations for holistic tracking
## Validation & Testing
Use the validation scripts in `scripts/` for pre-deployment checks:
- **scripts/validators.py** - Validate campaign data, bid values, budget amounts before applying changes
## Troubleshooting
**Common issues:**
1. **Execution timeout** - reduce scope with `.withLimit()` or process in batches
2. **Quota exceeded** - reduce API call frequency, use cached data
3. **Type errors** - remember micros conversion for currency values
4. **Null values** - always check for null before accessing properties
Use `Logger.log()` for debugging - view logs via View > Logs in the script editor.
## References
Load these on demand for detailed documentation:
- [references/ads-api-reference.md](references/ads-api-reference.md) - Complete AdsApp API reference including selectors, methods, conditions, statistics, and enterprise patterns
- [references/examples.md](references/examples.md) - Detailed code examples: pause low-quality keywords, optimise bids by ROAS, export campaign performance to Sheets
- [references/best-practices.md](references/best-practices.md) - Best practices with code blocks: batch operations, API filtering, error handling, micros conversion, audit logging
- [references/patterns.md](references/patterns.md) - Reusable automation patterns: conditional bid adjustment, quality score monitoring
Related in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".