Expert guidance for Google Ads Script development including AdsApp API, campaign management, ad groups, keywords, bidding strategies, performance reporting, budget management, automated rules, and optimization patterns. Use when automating Google Ads campaigns, managing keywords and bids, creating performance reports, implementing automated rules, optimizing 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 optimization, conversion tracking, error handling, and JavaScript-based automation in Google Ads editor.
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.
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.
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.
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.
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.
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.
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.
The most common pattern - pause keywords with low quality scores and high spend:
function pauseLowQualityKeywords() {
const keywords = AdsApp.keywords()
.withCondition('ad_group_criterion.status = "ENABLED"')
.withCondition('ad_group_criterion.quality_info.quality_score < 4')
.withCondition('metrics.cost_micros > 100000000') // 100 in account currency
.forDateRange('LAST_30_DAYS')
.get();
let count = 0;
while (keywords.hasNext()) {
keywords.next().pause();
count++;
}
Logger.log(`Paused ${count} low-quality keywords`);
}
.withCondition() instead of filtering in JavaScript.withLimit() and batch processing for large accounts (30-min timeout)See references/best-practices.md for detailed code examples of each practice.
Use the validation scripts in scripts/ for pre-deployment checks:
Common issues:
.withLimit() or process in batchesUse Logger.log() for debugging - view logs via View > Logs in the script editor.
Load these on demand for detailed documentation:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer