Script to bulk adjust bids to FirstPositionCpc

41 views
Skip to first unread message

James

unread,
Nov 26, 2019, 1:47:14 AM11/26/19
to Google Ads Scripts Forum
I would like know how to write a script to adjust my bids to FirstPositionCpc either upwards or downwards when that metric is available.

Can anyone help with this?
Screenshot_2.png

James

unread,
Nov 26, 2019, 1:54:58 AM11/26/19
to Google Ads Scripts Forum
Incidentally, if the max cpc exceeds the FirstPositionCpc, does that make a difference in actual bidding? Say the max CPC was $25 but FirstPositionCpc was $5, would there be an occasional $25 click?



Google Ads Scripts Forum Advisor

unread,
Nov 26, 2019, 4:24:35 AM11/26/19
to adwords...@googlegroups.com
Hi James,

Thanks for posting your concern.

To get you started with your script, you may refer to the sample code below. The sample code will retrieve all the keywords in your account using the keyword's selector and iterator. Then, by using the getFirstPageCpc() method, you will get the corresponding first page bid for the specific keywords. You can use the returned value of the getFirstPageCpc() method as a condition for setting different max cpc for keywords. Lastly, by using the setCpc() method and by putting a value to this method, you could change the max cpc of the keywords.

function main(){
  var keywordSelector = AdsApp
     .keywords();
  
  var keywordIterator = keywordSelector.get();
  while (keywordIterator.hasNext()) {
    var keyword = keywordIterator.next();
    var firstPositionBid = keyword.getFirstPageCpc();
    
    //Continue your code here
    //Use the firstPositionBid variable in the conditions for setting different values of max Cpc
    
    //Uncomment the line below for setting new Max Cpc
    //keyword.bidding().setCpc('Set new max cpc here');
  }
}


With regard to your concern on actual bidding, I'm afraid that this is already a product related question. With this, you may try to post your second question to Google Ads Help Community to get further support from the Google Ads product team as they are more equipped to provide support to this.

Hope this will help.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5001UODHGy:ref
Reply all
Reply to author
Forward
0 new messages