Google Ads Scripts for Beginners
- What Google Ads Scripts are and what they can automate
- How to set up and run your first script safely
- 3 ready-to-use scripts for budget alerts, QS monitoring, and bid adjustments
- How to schedule scripts to run automatically
What Are Google Ads Scripts?
Google Ads Scripts are JavaScript code snippets that run directly inside your Google Ads account. They can read your campaign data, make changes, send emails, and write to Google Sheets, all automatically, on a schedule, without any server or programming infrastructure.
They are completely free. You write them in the Google Ads interface, authorize them once, and they run on Google's own infrastructure. No API keys, no hosting, no dependencies.
You don't need to be a programmer. If you can follow a recipe, you can use scripts. This guide gives you three complete, working scripts, you only need to read and understand them, then customize the variables at the top.
What Scripts Can Do (And Can't Do)
Scripts CAN:
- Adjust keyword bids automatically based on rules or data
- Pause or enable keywords, ads, and ad groups
- Send email alerts when something needs attention
- Pull performance data into Google Sheets for dashboards or analysis
- Check for issues like low Quality Score, low impression share, or overspending
Scripts CANNOT:
- Create full campaigns from scratch easily (complex, not recommended)
- Replace dedicated automation platforms (they have API rate limits)
- Access data from outside Google's ecosystem without custom integrations
Setting Up Your First Script
- In Google Ads, click the wrench icon (Tools & Settings) in the top navigation.
- Under "Bulk Actions," click "Scripts."
- Click the blue "+" button to create a new script.
- Give it a descriptive name (e.g., "Budget Alert - All Campaigns").
- Paste your script code into the editor. Then click "Authorize" and grant access when prompted.
- Always click "Preview" first, this runs the script in read-only mode and shows you exactly what it would do, without making any changes.
- Once satisfied with the preview, click "Run" or set a schedule.
Script 1: Budget Utilization Alert
This script emails you if any campaign is spending more than 90% of its daily budget by 3pm, giving you time to act before the day ends.
// CONFIG — edit these values var ALERT_EMAIL = 'you@example.com'; var THRESHOLD = 0.90; // 90% of daily budget var ALERT_HOUR = 15; // 3pm account timezone function main() { var now = new Date(); if (now.getHours() < ALERT_HOUR) return; var campaigns = AdsApp.campaigns() .withCondition('Status = ENABLED') .get(); var alerts = []; while (campaigns.hasNext()) { var camp = campaigns.next(); var budget = camp.getBudget().getAmount(); var spent = camp.getStatsFor('TODAY').getCost(); if (spent / budget >= THRESHOLD) { alerts.push(camp.getName() + ': spent ' + spent.toFixed(2) + ' of ' + budget.toFixed(2)); } } if (alerts.length > 0) { MailApp.sendEmail(ALERT_EMAIL, 'Budget Alert: Campaigns near limit', alerts.join('\n')); } }
Schedule this script to run hourly. It will only send emails when the conditions are met (hour is 3pm or later AND a campaign exceeds 90% spend).
Script 2: Low Quality Score Alert
This script finds all keywords with Quality Score 4 or below AND cost greater than €50 in the last 30 days, then sends you a Google Sheets report.
// CONFIG — edit these values var SHEET_URL = 'YOUR_GOOGLE_SHEET_URL'; var QS_THRESHOLD = 4; var COST_THRESHOLD = 50; // minimum cost to flag function main() { var sheet = SpreadsheetApp .openByUrl(SHEET_URL).getActiveSheet(); sheet.clearContents(); sheet.appendRow(['Campaign','Ad Group','Keyword', 'QS','Cost (30d)']); var keywords = AdsApp.keywords() .withCondition('QualityScore <= ' + QS_THRESHOLD) .withCondition('Cost >= ' + COST_THRESHOLD) .forDateRange('LAST_30_DAYS') .get(); while (keywords.hasNext()) { var kw = keywords.next(); sheet.appendRow([ kw.getCampaign().getName(), kw.getAdGroup().getName(), kw.getText(), kw.getQualityScore(), kw.getStatsFor('LAST_30_DAYS').getCost() ]); } }
Script 3: Automatic Bid Adjustment by Day of Week
This script reads a Google Sheet where you define bid adjustment multipliers for each day of the week, then applies them to your campaigns automatically. This is useful when you know that weekends or specific days convert at different rates.
The structure: your Google Sheet has two columns, Day (Monday through Sunday) and Multiplier (e.g., 1.2 for +20%, 0.8 for -20%, 1.0 for no change). The script reads these values every day and applies the correct multiplier.
By reading from a Google Sheet instead of hardcoding values in the script, non-developers can update the bid adjustments without touching code. The marketing team updates the Sheet; the script reads it automatically.
Scheduling Scripts
After saving a script, click "Frequency" to set a schedule. Available options:
- Hourly: Best for monitoring scripts (budget alerts, anomaly detection). Runs once per hour at a time you specify.
- Daily: Best for reporting scripts and QS monitoring. Set it to run early morning so you have data ready to start your day.
- Weekly: Best for audit scripts and large-scale reporting. Run these on Monday mornings to fuel your weekly optimization review.
Never schedule a script without previewing it first. The Preview mode shows you exactly what the script would do (what emails it would send, what bids it would change) without executing any changes.
Resources for More Scripts
- Google Ads Scripts documentation: developers.google.com/google-ads/scripts, the official reference for all available APIs and methods
- Free Script Library by Russell Savage: freeadwordsscripts.com, hundreds of pre-built scripts for common tasks
- What AdPredictor does that scripts can't: Scripts run on schedules and work with data already in your account. AdPredictor audits the whole account at once, read-only, and hands you the plan: which search terms to block, which keywords to pause, what the tracking is missing, ordered by the money each fix recovers.
Test your knowledge
Click each question to reveal the answer.