// ...
function excludeSpamPlacementsAtAdGroupLevel(){Â Â Â var adGroupsIterator = AdWordsApp.adGroups()Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â .withCondition("AdGroupStatus IN [ENABLED, PAUSED]")Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â .withCondition("CampaignStatus IN [ENABLED, PAUSED]")Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â .get();Â Â Â while (adGroupsIterator.hasNext()){Â Â var adGroup = adGroupsIterator.next();
  Logger.log("Before excluding");  var excludeOperation = adGroup.display();     Logger.log("Before aux");  var aux = excludeOperation.newPlacementBuilder();     Logger.log("Before aux2");  var aux2 = aux.withUrl("test12345.com")     Logger.log("Before aux3");  var aux3 = aux2.exclude();     Logger.log("After excluding");
// ...
I've located the error at newPlacementBuilder method, but I don't know why it happens.Â
var adGroupsIterator = AdWordsApp.adGroups()
  .withCondition("AdGroupStatus IN [ENABLED, PAUSED]")
  .withCondition("CampaignStatus IN [ENABLED, PAUSED]")
  .withCondition("AdGroupType = 'DISPLAY_STANDARD'") // Specify AdGroupType
  .get();function excludeSpamPlacementsAtCampaignLevel(){   var campaignsIterator = AdWordsApp.campaigns()                  .withCondition("CampaignStatus IN [ENABLED, PAUSED]")                  .withCondition("AdNetworkType1 = 'CONTENT'")                  .get();   while (campaignsIterator.hasNext()){  var campaign = campaignsIterator.next();
  Logger.log("Before excluding at Campaign level");
  SPAM_LIST.forEach(function (placement_url) {   Logger.log(placement_url);         var excludeOperation = campaign.display().newPlacementBuilder().withUrl(placement_url).exclude();   Logger.log(placement_url + " excluded from " + campaign.getName() + " campaign");           });
  Logger.log("After excluding at Campaign level"); } } // End of excludeSpamPlacementsAtCampaignLevel function