Pages

Thursday, November 22, 2012

Delete All Disapproved Ads in an Account

Again, another simple script that just focuses on account maintenance. Over time, large accounts might build up thousands of adgroups with ads that might be disapproved. Sometimes, it makes sense to remove those and then slowly build and deploy new creative (we will have a script to build new creative later). Hopefully this will work for you.

Thanks,
Russ
//-----------------------------------
// Delete Ads That Are Disapproved
// Created By: Russ Savage
// FreeAdWordsScripts.com
//-----------------------------------
function main() {
  // Let's start by getting all of the ad that are disapproved
  var ad_iter = AdWordsApp.ads()
  .withCondition("ApprovalStatus != APPROVED")
  .get();

  // Then we will go through each one
  while (ad_iter.hasNext()) {
    var ad = ad_iter.next();
    // now we delete the ad
    Logger.log("Deleteing ad: " + ad.getHeadline());
    ad.remove();
  }
}