HomeFree tools404 checker
Google Ads script

Broken landing pages (404 checker)

Read-only. Requests the final URLs of all enabled ads and logs any that respond with an error (4xx/5xx) — so you catch dead landing pages before they waste budget. Deduplicates URLs.

By the SEOZ team · Updated June 12, 2026

All scripts
Read-only
function main() {
  // Read-only: checks the final URLs of enabled ads for broken responses (4xx/5xx).
  var checked = {};
  var broken = 0;
  var ads = AdsApp.ads()
    .withCondition('Status = ENABLED')
    .withCondition('CampaignStatus = ENABLED')
    .get();

  while (ads.hasNext()) {
    var ad = ads.next();
    var url = ad.urls().getFinalUrl();
    if (!url || checked[url]) continue;
    checked[url] = true;

    var status;
    try {
      var response = UrlFetchApp.fetch(url, { muteHttpExceptions: true, followRedirects: true });
      status = response.getResponseCode();
    } catch (e) {
      status = 'ERROR: ' + e;
    }

    if (typeof status === 'string' || status >= 400) {
      broken++;
      Logger.log(status + '  ' + url + '  (' + ad.getCampaign().getName() + ')');
    }
  }
  Logger.log('Done. Checked ' + Object.keys(checked).length + ' unique URLs, ' + broken + ' broken.');
}
How to run the script
  1. Google Ads → Tools → Bulk actions → Scripts.
  2. Click + and paste the code. Authorize when asked.
  3. Run a preview first and read the log.
  4. Schedule the script if you want it to run regularly.
SEOZ runs these checks for you — automatically, with alerts when something breaks.
Try the guided demo →More scripts