Pause Active Search Campaigns when the Total Daily Spend Exceeds A Certain Amount

50 views
Skip to first unread message

Morgan Ser

unread,
Jun 25, 2024, 8:00:06 PM (7 days ago) Jun 25
to Google Ads Scripts Forum
Hi there,

Hope all is well.

Could I check with the Google ads Script support team whether we are able to modify the script to achieve the following objective:

Context: There are YouTube and Search campaigns in a Google Ads account. Google Search campaigns have big fluctuation throughout the week based on the search demand. Account budget limit has been set in the account billing setting. We adjusted the pacing as needed but towards the end of the month, it is challenging to control the daily spend of the search campaigns and they would spend more than intended.

Google ads script's goal:
- To check for several campaigns and pause them when their combined total ad spend for the day exceeds a certain amount; then reactivate them the following day.

Thanks in advance if we can get the team's help to modify the Google ads script for us.

Regards,
Morgan

Google Ads Scripts Forum

unread,
Jun 28, 2024, 8:44:13 AM (5 days ago) Jun 28
to Google Ads Scripts Forum

Hi Morgan,

Thank you for reaching out to the Google Ads Scripts support team.

I would suggest that you go through the documents AdsApp.​VideoCampaignSelector and AdsApp.​CampaignSelector to retrieve Video and Search campaigns. You can use getStatsFor("TODAY").getCost() function to retrieve today’s cost of a campaign. Here is a sample code to get today’s cost.

AdsApp.Campaign().getStatsFor(“TODAY”).getCost(); // for search campaigns
AdsApp.VideoCampaign().getStatsFor(“TODAY”).getCost(); // for video campaigns

You can also get a campaign budget by using the “AdsApp.​BudgetSelector” method. To pause a campaign, you can use “ApsApp.Campaign.pause()” and “AdsApp.VideoCampaign.pause()” and you can enable them by using the “enable()” method.

I hope this helps! Kindly get back to us if you still need any help.

Thanks,
Google Ads scripts team
Reply all
Reply to author
Forward
0 new messages