AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Ads
3.2K members online now
3.2K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

AdWords Script Campaign Pause Notification

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I don't often post, but I need some help with an AdWords Script.  I am looking for a Script that will send me a notification whenever one of my Campaigns is Paused.  Does anyone have a script that will do this?

 

Thanks in advance!

 

John

2 Expert replyverified_user

Re: AdWords Script Campaign Pause Notification

Top Contributor
# 2
Top Contributor

This is just to ping @Jon_Gritton, our ultimate expert in scripts. He'll probably reply when he finds some free time.

Re: AdWords Script Campaign Pause Notification

Explorer ✭ ☆ ☆
# 3
Explorer ✭ ☆ ☆

Hello @John S

Try this one.
It will go over the account, get all the paused campaigns and send you a list of them by email:

function main() {
  
  // GET THE PAUSED CAMPAIGNS

  var campaignIterator = AdWordsApp.campaigns()
  .withCondition("Status = PAUSED")
  .get();
  

  // PREPARE THE MAIL BODY, WITH ALL PAUSED CAMPAIGNS
  
  var mailBody = '';
  while (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    var campaignName = campaign.getName();
    
    mailBody += campaignName + '<br />';
  }
  

  // SEND MAIL NOTIFICATION

  var accountName = AdWordsApp.currentAccount().getName();
  var mailSubject = "Paused Campaigns - " + accountName;
  MailApp.sendEmail('PLACE YOUR EMAIL HERE', mailSubject, mailBody,{'htmlBody':mailBody});
  
}

 

 

Re: AdWords Script Campaign Pause Notification

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Arik,
Thanks for posting this. I will try it out and let you know how it goes.

Re: AdWords Script Campaign Pause Notification

Top Contributor
# 5
Top Contributor

Hi @John S although @Arik's solution will work (of course!), unless your Account structure contains only enabled or removed Campaigns normally you might find you're getting too many "hits" by searching for all paused Campaigns.  A small modification using Labels might make the script more useful, so you can Label all the Campaigns you expect to be enabled, and check only those, rather than the script picking up paused Campaigns you have deliberately paused and know about.

 

In Arik's script, at the top where it says:

  var campaignIterator = AdWordsApp.campaigns()
  .withCondition("Status = PAUSED")
  .get();

replace this section with the following:

  var campaignIterator = AdWordsApp.campaigns()
  .withCondition("Status = PAUSED")
  .withCondition("LabelNames CONTAINS_ANY ['yourLabel']")
  .get();

Where yourLabel is the name of the Label you've used on the Campaigns you want tracked.  You'll need to create and apply this Label to the Campaigns before testing the script as it will fail if the Label doesn't exist.

 

Jon

 

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: AdWords Script Campaign Pause Notification

Explorer ✭ ☆ ☆
# 6
Explorer ✭ ☆ ☆

Excellent point @Jon_Gritton

 

AdWords Script Campaign Pause Notification

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hi Jon, I'm looking for a script to notify me via email immediately when campaigns in my account are paused. Do you know of any? the one listed above looks like it just scans all accounts and pulls paused campaigns but I'm looking for a notification that will email me immediately and let me know when something is paused. Thank you!