/**
will send you an email every time a campaign receives no impression the day before
http://catalyst.ca/blog/set-a-fire-alarm-on-your-accounts-with-adwords-scripts/
*/
function main() {
// Enter your account name and email here:
var accountName = "Account name";
var yourEmail = "your - email @your - domain.com";
var emailBody = "Yesterday, the following campaigns have had no impressions: <br> ";
var noImpCamp = 0;
var campaignsIterator = AdWordsApp.campaigns().get();
while (campaignsIterator.hasNext()) {
var campaign = campaignsIterator.next();
var stats = campaign.getStatsFor('YESTERDAY');
if ((stats.getImpressions() == 0) && (campaign.isEnabled())) {
emailBody = emailBody + campaign.getName() + "<br> ";
noImpCamp++;
}
}
if (noImpCamp > 0) {
MailApp.sendEmail(yourEmail, "Alert: "+accountName + "–" +noImpCamp + "Campaigns with no impressions", "", {
htmlBody: emailBody
});
}
}