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.

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

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