Hello Google Ads Scripts experts,
I am new to Google Ads scripts and I am at a dead end with the script I am trying to form through research.
My goal, with this script, is to automate keyword bid adjustments on a daily basis. I want this to happen only on specific campaign(s).
My idea with this script is:
Every day, once a day, check if keyword max. cpc is > $10
If so, then check if keyword max. cpc is < est. Top of Page Bid
If so, then check if est. Top of Page Bid is < $10
If conditions are met, then set keyword max. cpc to est. Top of Page Bid
If those conditions are not met, then check if keyword max cpc is < est. First of Page Bid
If so, then check if est. First of Page Bid is < $10
If conditions are met, then set keyword max. cpc to est. First of Page Bid
If those conditions are still not met, then set max. cpc to $10
Here is how the script is looking right now but it is still far from the output the script should be accomplishing:
function main() {
var keywords=AdWordsApp
.keywords()
.withCondition("CampaignName CONTAINS_IGNORE_CASE 'Google'")
.withCondition("CampaignStatus = ENABLED")
.withCondition("Status = ENABLED")
.withCondition("MaxCpc < 10.00")
.forDateRange("TODAY")
.get();
while(keywords.hasNext())
{
var keyword=keywords.next();
var bid=keyword.getMaxCpc();
var topofPage=keyword.getTopOfPageCpc();
if(bid < topofPage)
if(topofPage < 10.00) {
Logger.log("The bid for "+keyword.getText()+" will be raised from "+bid+" to "+topofPage);
keyword.setMaxCpc(topofPage);
}
}
}