How to bid position in AdGroup level by label name?

38 views
Skip to first unread message
Message has been deleted

Peter Vretenička

unread,
Aug 7, 2017, 11:02:51 PM8/7/17
to AdWords Scripts Forum
Please how should I adjust this script, when I need to bid the position only for AdGroups, that have labels named ,,bid2":  

var TARGET_AVERAGE_POSITION = 2;

var TOLERANCE = 0.1;

var BID_ADJUSTMENT_COEFFICIENT = 1.10;

function main() {
  raiseKeywordBids();
  lowerKeywordBids();
}

function raiseKeywordBids() {
  var keywordsToRaise = getKeywordsToRaise();

  while (keywordsToRaise.hasNext()) {
    var keyword = keywordsToRaise.next();
    keyword.bidding().setCpc(getIncreasedCpc(keyword.bidding().getCpc()));
  }
}

function lowerKeywordBids() {
  var keywordsToLower = getKeywordsToLower();

  while (keywordsToLower.hasNext()) {
    var keyword = keywordsToLower.next();
    keyword.bidding().setCpc(getDecreasedCpc(keyword.bidding().getCpc()));
  }
}

function getIncreasedCpc(cpc) {
  return cpc * BID_ADJUSTMENT_COEFFICIENT;
}

function getDecreasedCpc(cpc) {
  return cpc / BID_ADJUSTMENT_COEFFICIENT;
}

function getKeywordsToRaise() {
  return AdWordsApp.adGroups()
      .withCondition('Status = ENABLED')
      .withCondition('AveragePosition > ' + (TARGET_AVERAGE_POSITION + TOLERANCE))
      .orderBy('AveragePosition ASC')
      .forDateRange('LAST_7_DAYS')
      .get();
}

function getKeywordsToLower() {
  return AdWordsApp.adGroups()
      .withCondition('Ctr > 0.01')
      .withCondition('AveragePosition < ' + (TARGET_AVERAGE_POSITION - TOLERANCE))
      .withCondition('Status = ENABLED')
      .orderBy('AveragePosition DESC')
      .forDateRange('LAST_7_DAYS')
      .get();
}

Thea Vega (AdWords Scripts Team)

unread,
Aug 8, 2017, 4:09:00 AM8/8/17
to AdWords Scripts Forum
Hi Peter,

In order for the Bid to Position script to work only on ad groups with specific labels, you need to use filtering. Just add the below code snippet after return AdWordsApp.adGroups() on functions getKeyWordsToRaise() and getKeyWordsToLower().

function getKeywordsToRaise() {
 
return AdWordsApp.adGroups()
 
.withCondition("LabelNames CONTAINS_ALL ['INSERT_LABEL_NAME_HERE']")

 
.orderBy('AveragePosition ASC')
 
.forDateRange('LAST_7_DAYS')
 
.get();
}

If you have further questions, feel free to contact us.

Thanks,
Thea
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages