πŸ€–chiliad
ClaudePricing
Back to blog
March 11, 2026Β·Dmytro Tonkikh

Google Ads Scripts: A Beginner's Guide for 2026

google ads
scripts
tutorial

Google Ads scripts are one of the most powerful β€” and underused β€” tools in a PPC manager's toolkit. They let you automate tasks, generate reports, and make changes across your accounts using JavaScript that runs directly inside Google Ads, for free, with no servers to host and no API access to apply for.

This guide is the one I wish I had when I started writing scripts 13 years ago. By the end you will understand what scripts are, how they actually run, how to ship your first one, and the handful of mistakes that trip up almost every beginner.

What Are Google Ads Scripts?

At their core, Google Ads scripts are small JavaScript programs that interact with the Google Ads API on your behalf. They run on Google's servers β€” not your computer β€” on a schedule you define: hourly, daily, weekly, or on demand.

Think of them as macros for Google Ads. Instead of manually checking search terms, adjusting bids, or pausing keywords every day, you write a script once and it does the work for you, every day, without you logging in.

The key thing that makes scripts approachable: you do not need to be a developer or set up API credentials. If you can copy code and read a report, you can run scripts. And when you outgrow copy-paste, that is where a platform like chiliad comes in β€” more on that at the end.

What Can Scripts Do?

Almost anything you can do in the Google Ads UI, you can automate with a script β€” usually faster and across more accounts:

  • Bid management β€” Adjust bids or bid modifiers based on performance thresholds, time of day, device, or even external signals like weather
  • Negative keywords β€” Mine search term reports daily and add irrelevant queries as negatives automatically
  • Placement exclusions β€” Clean up Display and Performance Max placements that burn budget on mobile games and junk apps
  • Reporting β€” Push custom reports into Google Sheets or email with exactly the metrics you care about
  • Alerts β€” Get notified the moment spend spikes, conversions drop to zero, budgets cap out, or ads get disapproved
  • Budget management β€” Pace spend across the month, enforce hard caps, or reallocate between campaigns based on performance
  • Account hygiene β€” Flag broken landing page URLs, audit RSA ad strength, catch keyword cannibalization, and find zombie keywords

How Do Scripts Work?

Every Google Ads script has a main() function β€” this is the entry point Google calls when the script runs. Inside, you use two building blocks: selectors to fetch entities (campaigns, keywords, ads) and reports to pull raw performance data.

Here is a selector in action β€” it finds keywords that spent money but never converted, and pauses them:

function main() {
  var keywords = AdsApp.keywords()
    .withCondition("metrics.clicks > 100")
    .withCondition("metrics.conversions = 0")
    .forDateRange("LAST_30_DAYS")
    .get();

  while (keywords.hasNext()) {
    var keyword = keywords.next();
    keyword.pause();
    Logger.log("Paused: " + keyword.getText());
  }
}

Selectors are great for making changes. But when you just need data β€” for a report or a threshold check β€” the modern approach is a GAQL query (Google Ads Query Language). GAQL replaced the old AWQL syntax, and if you learned scripts years ago, this is the single biggest thing to relearn:

function main() {
  var report = AdsApp.report(
    "SELECT campaign.name, metrics.clicks, metrics.cost_micros " +
    "FROM campaign " +
    "WHERE metrics.clicks > 100 " +
    "DURING LAST_30_DAYS");

  var rows = report.rows();
  while (rows.hasNext()) {
    var row = rows.next();
    // cost is returned in micros: divide by 1,000,000 for the real amount
    var cost = row["metrics.cost_micros"] / 1000000;
    Logger.log(row["campaign.name"] + ": $" + cost.toFixed(2));
  }
}

Two beginner gotchas hide in that example: field names use the GAQL schema (metrics.cost_micros, not Cost), and money is always returned in micros β€” millionths of a currency unit β€” so you divide by 1,000,000.

Your First Script, Step by Step

You do not need to install anything. Everything happens inside Google Ads:

  1. In Google Ads, open Tools & Settings → Bulk Actions → Scripts
  2. Click the blue + button to create a new script
  3. Paste your code and click Authorize β€” you grant the script permission to act on your account (a one-time step)
  4. Click Preview. This runs the script in a dry run: you see the logs and what would change, without anything actually changing. Always preview first.
  5. When you are happy, click Run, then set a Schedule (hourly, daily, weekly) so it keeps running on its own

That is the whole loop: paste, authorize, preview, run, schedule. Google's own Get started guide walks through the same steps with screenshots.

Single Account vs. MCC Scripts

Single account scripts run inside one Google Ads account and can only touch that account's data. They are simpler to write, easier to debug, and where every beginner should start.

MCC (Manager) scripts run at the manager-account level and can loop across all your child accounts from one place. They are essential for agencies, but you have to handle account selection yourself:

function main() {
  var accounts = AdsManagerApp.accounts()
    .withCondition("metrics.cost_micros > 0")
    .forDateRange("LAST_30_DAYS")
    .get();

  while (accounts.hasNext()) {
    var account = accounts.next();
    AdsManagerApp.select(account); // switch context to this client
    // AdsApp now operates on the selected child account
  }
}

One MCC script can protect or report on every client at once β€” but it also means one bad line of code can affect every client at once. Preview carefully, and start with read-only reporting before you let an MCC script make changes.

Common Beginner Mistakes

After reviewing hundreds of scripts, these are the traps I see most often:

  • Running before previewing. Preview is a free dry run. There is no reason to skip it, and it will save you from an embarrassing bulk pause.
  • No date range. A selector without forDateRange can behave unexpectedly. Always scope your data window explicitly.
  • Ignoring the micros trap. Reporting $4,200,000 instead of $4.20 because you forgot to divide by a million.
  • No guard rails. A script that pauses "everything with zero conversions" will happily pause a brand-new campaign that has not had time to convert. Add minimum-clicks or minimum-spend thresholds.
  • No error handling or alerting. Wrap risky work in try/catch and email yourself on failure β€” otherwise a silently broken script looks exactly like a working one.
  • Using old AWQL syntax. Scripts copied from old blog posts often use deprecated report queries that no longer run. If a script throws query errors, it probably needs a GAQL rewrite.

Limitations to Know

  • 30-minute execution limit β€” Scripts that run longer are terminated. Large accounts and MCCs need batching or parallel execution.
  • No external libraries β€” You cannot import npm packages. You get Google's built-in classes and vanilla JavaScript.
  • Hourly scheduling floor β€” The finest schedule is hourly. For anything closer to real time you need an external system.
  • No version control β€” Google does not track script changes. Overwrite a working script with a broken one and the old version is simply gone.
  • No cross-account library β€” Paste the same script into 30 accounts and you now maintain 30 copies. Fix a bug once, paste it 30 times.

Those last two are exactly the problems chiliad was built to solve: every script keeps a full version history, and you paste a lightweight loader once β€” future code changes deploy to every account automatically.

Where to Go From Here

The fastest way to get value is a pre-built script from a trusted source. The chiliad marketplace has 100+ free Google Ads scripts you can install in one click β€” placement cleaners, budget pacers, disapproval monitors, and more β€” no coding required.

If you want to write your own, start with Google's official Get started guide and always test in Preview before you run.

And once you are running more than a couple of scripts across more than a couple of accounts, a management platform like chiliad keeps everything organized, versioned, monitored, and updated from one place β€” so you spend your time on strategy, not copy-pasting.

Ready to Automate Your Google Ads?

Install scripts with one click and manage them across all your accounts from a single dashboard.

πŸ€–chiliad

The platform for managing and automating Google Ads scripts at scale. Built for PPC agencies and freelancers.

Product

  • Use Cases
  • Features
  • Claude connector
  • Pricing
  • Marketplace
  • Blog
  • About
  • Roadmap
  • Changelog

Support

  • Contact Us
  • Help Center
  • Terms of Service
  • Privacy Policy

Β© 2026 chiliad. All rights reserved.