Skip to content

Instantly share code, notes, and snippets.

@g-ads-org
Created March 16, 2019 11:05
Show Gist options
  • Save g-ads-org/8369eea5123bea776489a99080b73aaf to your computer and use it in GitHub Desktop.
Save g-ads-org/8369eea5123bea776489a99080b73aaf to your computer and use it in GitHub Desktop.
function main() {
var costReport = AdWordsApp.report("Select Cost from ACCOUNT_PERFORMANCE_REPORT");
var reportRow = costReport.rows().next();
var totalCost = reportRow["Cost"].replace(',', '');
if (totalCost > 1000) {
var campaignIterator = AdWordsApp.campaigns().withCondition("Status = ENABLED").get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
campaign.pause();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment