Set a Fire Alarm on Your Accounts With Adwords Scripts

We can automate a great deal of SEM activities, yet successful campaigns require frequent attention. Just as any media, a lot can go wrong:

Surprise editorial reviews pausing all activities, innocent mistakes shutting down the account, click surge (or fraud) emptying the budget, aggressive competitor bids kicking your ads off page, and many more!

In most emergencies, quick response-time can often undo the damage. Any tool that shortens reaction time and diagnoses the problem is, ultimately, of great helps to web marketers.

Scripts Can Help

Enter Adwords Scripts, one of the newest tools Google has made available to developers. Lighter and simpler than Adwords API and more versatile than Automated Rules, Scripts are designed to enable users to automate their most repetitive tasks.

Adwords Scripts can be leveraged to install “fire alarms” in all your accounts. Just like real fire alarms, these are designed to alert you if there is ever an emergency in your account.

Programming an Adwords “Zero Impressions” Email Alarm

If a campaign has no impressions on a given day, it’s certainly not a good thing. You may have to investigate what is happening. Other, more sophisticated alarms and notification can be implemented, but zero-impressions alarm is a solid basis for nearly all accounts and a good introduction to Adwords Scripts.

To program an email alert for zero impressions, follow these steps

  1. Log into your Adwords account.
  2. Click on the Campaigns tabs.
  3. Click on Automation in the left-hand pane.
  4. Click on Scripts.
  5. Click on Create Script.
  6. Type “zero-impression alarm” in the Script field.
  7. You may have to authorize the script by clicking on the Authorize script button
  8. Remove all the text in the code area and paste the lines at the bottom of this post
  9. Change accountName and yourEmail variable (lines 3 and 4) to your account name and email.
  10. Save the script by clicking on the Save button.
  11. You may want to Preview the script before running it by clicking on the Preview button.
  12. Click on Run the Script Now.
  13. When you will be taken back to the main script page, click on Create schedule next to your freshly made script.
  14. Choose Daily from the drop down menu, then 2 or 3AM (You want the script to run when all of yesterday’s data has been collected and before you wake up!).
  15. Click Save.

function main() {

// Enter your account name and email here:

var accountName = “Account name”;

var yourEmail = “”;

var emailBody=”Yesterday, the following campaigns have had no impressions:<br>”;

var noImpCamp=0;

var campaignsIterator = AdWordsApp.campaigns().get();

while (campaignsIterator.hasNext()) {

var campaign =;

var stats = campaign.getStatsFor(‘YESTERDAY’);

if ((stats.getImpressions() == 0)&&(campaign.isEnabled())) {

emailBody = emailBody + campaign.getName() + “<br>”;




if (noImpCamp > 0) {

MailApp.sendEmail(yourEmail,”Alert: ” + accountName + ” – ” + noImpCamp + ” Campaigns with no impressions”,””,{htmlBody: emailBody})



Voilà! Your script will send you an email every time a campaign receives no impression the day before.

In most cases, this level of monitoring is not enough, but it works as a timely signal to act quickly on a potential problem. Also, like real world fire alarms, false alerts can happens more often than bona fide emergencies (burnt toast anyone?) but it’s better to be safe than sorry!

2 thoughts on “Set a Fire Alarm on Your Accounts With Adwords Scripts

Leave a Reply

Your email address will not be published. Required fields are marked *