Trigger in Google Ads Script

279 views
Skip to first unread message

Arianna

unread,
Jun 25, 2020, 5:15:32 AM6/25/20
to Google Ads Scripts Forum
Hi there, I'm trying to implement a script that pause the video campaign on google ads when they reach a certain number of views. Would it be possible to set a trigger every 15 minutes which check the specific campaign? 

At the moment I'm using this script but the frequency of execution could be set just every hour, is there a way I can implement the script to run every 15 minutes? 

function main() {

  var videoCampaignIterator = AdsApp.videoCampaigns().withCondition('Name = "Name of the campaign"').get();

  if (videoCampaignIterator.hasNext()) {

   

    var videoCampaign = videoCampaignIterator.next();

    var stats = videoCampaign.getStatsFor('ALL_TIME');

    var views = stats.getViews();

   

    Logger.log(videoCampaign.getName() + ', ' + stats.getImpressions() +

        ' impressions, ' + stats.getViews() + ' views');

  }

  if(views > 5000)  {

    Logger.log("Views bigger than threshold, pausing");

    videoCampaign.pause();

  }

}


Google Ads Scripts Forum Advisor

unread,
Jun 25, 2020, 6:48:34 AM6/25/20
to adwords-scripts+apn2wqelkqmkgl9a...@googlegroups.com, adwords-scripts+apn2wqelkqmkgl9a...@googlegroups.co, adwords...@googlegroups.com
Hi Arianna,

I'm afraid that there is currently no way in Scripts to schedule tasks on a in-minutes basis. It can only be triggered hourly.

That said, allow me to raise a feature request regarding this. I am, however, unable to guarantee that this feature can be available soon. For now, you may follow our blog for any updates or announcements.

Thanks,
Peter
Google Ads Scripts Team

ref:_00D1U1174p._5004Q219ICZ:ref

Sigurd

unread,
Jun 25, 2020, 7:36:16 AM6/25/20
to Google Ads Scripts Forum
Hi Arianna,

While it is not possible to schedule the trigger to more often than hourly, there's nothing to prevent you from running e.g. four independent instances of your script. You'll notice that if it's 14 min past when you schedule your script to run hourly, the next run will also happen 14 min past etc

 sigurd

Google Ads Scripts Forum Advisor

unread,
Jun 26, 2020, 2:17:10 AM6/26/20
to adwords-scripts+apn2wqevinbbivog...@googlegroups.com, adwords...@googlegroups.com
Hi Arianna,

In addition to what Sigurd has recommended, our team would also like to recommend that you consider using the AdWords/Google Ads API for more options if you want real-time / close to real-time changes to campaign status based on other triggers.

For more information, you can reach out to the API team via their dedicated forum. I hope this helps.
Reply all
Reply to author
Forward
0 new messages