Thanks,
Russ
/*********************************************
* Pause Keywords With No Impressions All Time
* Version 1.1
* Changelog v1.1
* - Updated for speed and added comments
* Created By: Russ Savage
* FreeAdWordsScripts.com
**********************************************/
var TO_NOTIFY = "your_email@domain.com";
function main() {
// Let's start by getting all of the keywords with no impressions
var kwIter = AdWordsApp.keywords()
.withCondition("Impressions = 0") // could be "Clicks = 0" also
.forDateRange("ALL_TIME") // could use a specific date range like "20130101","20131231"
.withCondition("Status = ENABLED")
.withCondition("CampaignStatus = ENABLED")
.withCondition("AdGroupStatus = ENABLED")
.get();
// It is much faster to store all the keywords you want to process
// and then make the changes all at once. This takes advantage
// of the batch processing behind the scenes.
var toPause = [];
while (kwIter.hasNext()) {
var kw = kwIter.next();
toPause.push(kw);
// This is to make sure you see things during the preview
// When you run it for real, you can remove this clause to
// increase speed.
if(AdWordsApp.getExecutionInfo().isPreview() &&
AdWordsApp.getExecutionInfo().getRemainingTime() < 10) {
break;
}
}
// Now go through each one and pause them.
for(var i in toPause) {
toPause[i].pause();
//Or you could use toPause[i].remove(); to delete the keyword altogether
}
// Sent an email to notify you of the changes
MailApp.sendEmail(TO_NOTIFY,
"AdWords Script Paused "+toPause.length+" Keywords.",
"Your AdWords Script paused "+toPause.length+" keywords.");
}