Introduction
Google Ads Scripts are powerful tools that allow advertisers to automate repetitive tasks, customize campaign management, and enhance performance monitoring using JavaScript-based code. While automated rules in Google Ads allow you to perform specific actions based on predefined conditions (like pausing a keyword when cost exceeds ₹500), scripts offer far more flexibility and control. You can think of Google Ads Scripts as the advanced version of automated rules, capable of complex logic, data pulling, scheduling, and cross-account optimization.
Using scripts for automated rules is ideal for advertisers managing large accounts, multiple campaigns, or real-time bidding and budget adjustments. Unlike automated rules that have basic UI limitations, scripts can interact with external data, log reports to Google Sheets, and make decisions that would be impossible in the standard rule engine.
What Are Google Ads Scripts?
Google Ads Scripts are JavaScript-based snippets that run inside your Google Ads account. They interact with your campaigns, ad groups, keywords, and ads by using the Google Ads API in a simplified scripting language. These scripts can automate tasks like:
– Pausing underperforming ads
– Sending daily performance summaries to your email
– Adjusting bids based on weather or stock price data
– Auto-labeling keywords based on Quality Score
– Scheduling budget changes during sales periods
Why Use Scripts Instead of Standard Automated Rules?
Standard automated rules are limited to basic “if-this-then-that” logic and can’t access external sources, log custom reports, or manipulate bulk data flexibly. Scripts overcome this by allowing:
– Custom timeframes
– Complex multi-layered conditions
– Integration with Google Sheets, APIs, or CRMs
– Logging and real-time alerts
– Scalable actions across large or MCC accounts
How to Access and Set Up a Script
-
Log into your Google Ads account
-
Go to Tools & Settings (top menu) → Bulk Actions → Scripts
-
Click the + button to create a new script
-
Paste or write your JavaScript code in the editor
-
Authorize the script to access your account
-
Click Preview to see what the script will do without making changes
-
If the preview looks good, click Run
-
You can also schedule the script to run hourly, daily, weekly, or monthly
Example 1: Pause Low-Performing Keywords Script
Let’s say you want to pause any keyword that has spent more than ₹1000 and has zero conversions over the last 7 days.
function main() {
var keywordIterator = AdsApp.keywords()
.withCondition("Conversions < 1")
.withCondition("Cost > 1000")
.forDateRange("LAST_7_DAYS")
.get();while (keywordIterator.hasNext()) {var keyword = keywordIterator.next();
keyword.pause();
Logger.log(“Paused keyword: “ + keyword.getText());
}
}
This script can replace what would normally require multiple rules across campaigns and ad groups.
Example 2: Email Daily Performance Summary
Want to receive daily campaign performance summaries directly to your email?
function main() {
var report = AdsApp.report(
"SELECT CampaignName, Clicks, Impressions, Cost, Conversions " +
"FROM CAMPAIGN_PERFORMANCE_REPORT " +
"DURING YESTERDAY");var rows = report.rows();var summary = “Campaign Performance (Yesterday):\n\n”;
while (rows.hasNext()) {
var row = rows.next();
summary += row[‘CampaignName’] + “: “ + row[‘Clicks’] + ” clicks, “ +
row[‘Impressions’] + ” impressions, ₹” + row[‘Cost’] + ” cost, “ +
row[‘Conversions’] + ” conversions\n”;
}
MailApp.sendEmail(“your-email@example.com”, “Daily Campaign Summary”, summary);
}
This level of automation isn’t possible with regular automated rules.
Example 3: Change Bids Based on Device Performance
Let’s increase bids for mobile devices if conversion rate is higher than 5%.
function main() {
var campaignIterator = AdsApp.campaigns().get();while (campaignIterator.hasNext()) {var campaign = campaignIterator.next();
var stats = campaign.getStatsFor(“LAST_7_DAYS”);
if (stats.getMobileConversionRate() > 0.05) {
campaign.targeting().platforms().mobile().setBidModifier(1.2);
Logger.log(“Increased mobile bid for: “ + campaign.getName());
}
}
}
Best Practices for Using Scripts for Automation
– Always preview first: Preview mode shows what the script will do without actually making changes
– Use labels: Before applying actions like pause/delete, label them first so you can track what changed
– Schedule smartly: Don’t run complex scripts too frequently—they can slow down performance or exceed limits
– Log changes: Use Logger.log or Google Sheets integration to keep a record of changes
– Combine with alerts: Have scripts email you when thresholds are met, so you’re always aware of automation actions
– Test in a sandbox account: If you’re unsure, test your script in a dummy account before applying to live campaigns
Example: MakeMyTrip Automating Ad Scheduling for Seasonal Destinations
MakeMyTrip wants to increase visibility for “Goa Beach Resorts” from Friday to Sunday and reduce visibility Monday to Thursday. Instead of manually adjusting bids each week, they use this script:
function main() {
var today = Utilities.formatDate(new Date(), AdsApp.currentAccount().getTimeZone(), 'EEEE');var bidModifier = (today == “Friday” || today == “Saturday” || today == “Sunday”) ? 1.3 : 0.7;
var campaignIterator = AdsApp.campaigns()
.withCondition(“Name CONTAINS ‘Goa Beach'”)
.get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
campaign.setBidModifier(bidModifier);
Logger.log(“Set bid modifier to “ + bidModifier + ” for “ + campaign.getName());
}
}
This ensures MakeMyTrip spends more when weekend demand is high without manual intervention.
Conclusion
Scripts for automated rules in Google Ads give advertisers the freedom and power to execute complex logic that traditional automated rules cannot. Whether you’re managing massive eCommerce accounts, travel campaigns, or local services, using scripts can help you cut time, reduce manual errors, and make smarter, faster decisions. From pausing poor-performing keywords to real-time reporting and dynamic bidding, Google Ads Scripts transform how automation is applied inside your campaigns. Once you understand the fundamentals and start with templates, the opportunities for optimization are almost endless.








