Free Tools · Scripts Library

Helpful Google Ads Scripts

Copy-paste scripts that protect your budget and save hours of manual work. Commented, free, no signup. New scripts added regularly.

How to install any script: In Google Ads go to Tools → Bulk actions → Scripts → +, paste the code, click Authorize, then always run Preview first to check the logs before scheduling. Schedule from the Frequency column (hourly/daily as noted per script).

⏰ Budget Pacing Alert

Schedule: hourly · Level: single account · Edit: EMAIL + THRESHOLD

Emails you when any campaign has already spent a high share of its daily budget early in the day — the classic signature of competitor clicking and bot drains. Catch it at 11am instead of discovering it at midnight.

// ===== Budget Pacing Alert — ClickAdsProtector.com =====
// Emails you when a campaign spends too much of its daily
// budget too early. Schedule: HOURLY.

var EMAIL = 'you@yourcompany.com';   // <-- your email
var THRESHOLD = 0.70;                // alert at 70% of budget
var BEFORE_HOUR = 14;                // ...spent before 2pm

function main() {
  var now = new Date();
  var hour = parseInt(Utilities.formatDate(
    now, AdsApp.currentAccount().getTimeZone(), 'HH'), 10);
  if (hour >= BEFORE_HOUR) return; // only check mornings

  var alerts = [];
  var it = AdsApp.campaigns()
    .withCondition('Status = ENABLED').get();

  while (it.hasNext()) {
    var c = it.next();
    var budget = c.getBudget().getAmount();
    var spend = c.getStatsFor('TODAY').getCost();
    if (budget > 0 && spend / budget >= THRESHOLD) {
      alerts.push(c.getName() + ' — spent ' +
        spend.toFixed(2) + ' of ' + budget.toFixed(2) +
        ' (' + Math.round(spend / budget * 100) + '%)');
    }
  }

  if (alerts.length) {
    MailApp.sendEmail(EMAIL,
      '[Google Ads] Budget draining early — ' + alerts.length + ' campaign(s)',
      'These campaigns hit ' + (THRESHOLD * 100) + '% of daily budget before ' +
      BEFORE_HOUR + ':00:\n\n' + alerts.join('\n') +
      '\n\nEarly budget drain is a common sign of click fraud.' +
      '\nCheck your click logs or see clickadsprotector.com');
  }
}

🗂️ IP Exclusion List Backup

Schedule: daily · Level: single account · Edit: SHEET_URL

Google Ads allows max 500 excluded IPs per campaign, and lists get overwritten as tools rotate them. This script snapshots every campaign's IP exclusions into a Google Sheet daily — your audit trail for invalid-click refund claims.

// ===== IP Exclusion Backup — ClickAdsProtector.com =====
// Saves all campaign IP exclusions to a Google Sheet.
// Create a blank Sheet, paste its URL below. Schedule: DAILY.

var SHEET_URL = 'PASTE_YOUR_GOOGLE_SHEET_URL_HERE';

function main() {
  var ss = SpreadsheetApp.openByUrl(SHEET_URL);
  var name = Utilities.formatDate(new Date(),
    AdsApp.currentAccount().getTimeZone(), 'yyyy-MM-dd');
  var sheet = ss.getSheetByName(name) || ss.insertSheet(name);
  sheet.clear();
  sheet.appendRow(['Campaign', 'Excluded IP / Range']);

  var rows = 0;
  var it = AdsApp.campaigns()
    .withCondition('Status IN [ENABLED, PAUSED]').get();

  while (it.hasNext()) {
    var c = it.next();
    var ips = c.targeting().excludedIpAddresses().get();
    while (ips.hasNext()) {
      sheet.appendRow([c.getName(), ips.next().getIpAddress()]);
      rows++;
    }
  }
  Logger.log('Backed up ' + rows + ' IP exclusions to sheet "' + name + '"');
}

💸 Zero-Conversion Spend Report

Schedule: weekly · Level: single account · Edit: EMAIL + MIN_COST + DAYS

Lists every keyword that spent real money in the last 30 days without a single conversion — sorted by waste. Pair it with your click logs: a high-spend zero-conversion keyword with instant bounces usually means invalid traffic, not a bad keyword.

// ===== Zero-Conversion Spend Report — ClickAdsProtector.com =====
// Emails the keywords that spent money with 0 conversions.
// Schedule: WEEKLY.

var EMAIL = 'you@yourcompany.com'; // <-- your email
var MIN_COST = 20;                 // ignore spend below this
var DAYS = 'LAST_30_DAYS';

function main() {
  var lines = [];
  var it = AdsApp.keywords()
    .withCondition('Status = ENABLED')
    .withCondition('Conversions = 0')
    .withCondition('Cost > ' + MIN_COST)
    .forDateRange(DAYS)
    .orderBy('Cost DESC')
    .withLimit(50).get();

  while (it.hasNext()) {
    var k = it.next();
    var s = k.getStatsFor(DAYS);
    lines.push(s.getCost().toFixed(2) + '  |  ' +
      k.getText() + '  |  ' + s.getClicks() + ' clicks  |  ' +
      k.getCampaign().getName());
  }

  if (lines.length) {
    MailApp.sendEmail(EMAIL,
      '[Google Ads] ' + lines.length + ' keywords burning budget with 0 conversions',
      'Cost | Keyword | Clicks | Campaign\n' +
      '--------------------------------\n' + lines.join('\n') +
      '\n\nHigh spend + zero conversions + instant bounces often = ' +
      'invalid clicks. Verify with landing-page tracking: clickadsprotector.com');
  } else {
    Logger.log('No zero-conversion keywords above ' + MIN_COST);
  }
}

Always test scripts with Preview before scheduling. Scripts are provided as-is — adjust thresholds to your account.

Scripts alert you. We act for you.

Scripts can tell you something is wrong — ClickAds Protector finds the fraudulent IPs behind it and blocks them automatically, 24/7.

See Pricing   Try the Free Targeting Tool →