error: Value is lower than required minimum value.

2,424 views
Skip to first unread message

m.b...@medidate.de

unread,
Mar 1, 2016, 11:05:25 AM3/1/16
to AdWords Scripts Forum
Hey guys.

I am having trouble with this script. Basically I am summing up across placements and based on the total performance I want to set the new bid. The script runs perfectly well, also in the preview i get the desired resulst. But when I execute it says in the changes:

Value is lower than required minimum value.
Attempted new value: €0.50.


Does anybody know where this is coming from? The bids are set at the very end of the script. Thanks in advance!!


Regards,
Marius



Script:


//Select all placements from account with cost > 0  and Impr > 0

function main() {
  var placementSelector = AdWordsApp.display()
     .placements()
     .withCondition("Cost > 0")
     .withCondition("Impressions > 0")
     .forDateRange("LAST_30_DAYS")             
   
  
//Define variables needed during the script  

var i = 0
var placementname = new Array();
var sumCost = 0;
var sumLeads = 0;
var totalCost = new Array();
var totalLeads = new Array();
var CPL = new Array();
  
 var placementIterator = placementSelector.get();
 while (placementIterator.hasNext()) {
   var placement = placementIterator.next();
   
   //get placement URL as variable
   var current_name = placement.getUrl()
   
   //write placement URL into the i-th row of the vector placementname
   placementname[i] = current_name
   
   //increase i by 1
   i++;
 }
  
     var unique = placementname.filter(function(elem, index, array) {
    return index == array.indexOf(elem);
})
     
     for(i = 0; i < unique.length; i++){                                     
    
      var placementSelector = AdWordsApp.display()
     .placements()
     .withCondition("PlacementUrl STARTS_WITH " + "'" + unique[i] + "'")
     .withCondition("Cost > 0")
     .forDateRange("LAST_30_DAYS")
        
        
     var placementIterator = placementSelector.get();
     while (placementIterator.hasNext()) {
   var placement = placementIterator.next();
   var current_name = placement.getUrl()
      var stats = placement.getStatsFor("LAST_30_DAYS");
       
       if(unique[i] == current_name)
       {sumCost += stats.getCost()
        sumLeads += stats.getConversions()};                               
     }
       totalCost[i] = sumCost;
       totalLeads[i] = sumLeads;
       CPL[i] = totalCost[i] / totalLeads[i]
       sumCost = 0
       sumLeads = 0
       if(totalCost[i] > 30 && totalLeads[i] == 0){Logger.log(unique[i] + " total cost was: " + totalCost[i] + " total Leads were: " + totalLeads[i] + " CPL: " + CPL[i])};
       

  
}  
   for(i = 0; i < unique.length; i++){
     if(totalCost[i] > 25){
           
     var placementSelector = AdWordsApp.display()
     .placements()
     .withCondition("Cost > 0")
     .withCondition("PlacementUrl STARTS_WITH " + "'" + unique[i] + "'")
     .forDateRange("LAST_30_DAYS")
        
  var placementIterator = placementSelector.get();
     while (placementIterator.hasNext()) {
   var placement = placementIterator.next();
   var current_name = placement.getUrl()
   
   if(totalCost[i] > 40 && totalLeads[i] == 0){placement.bidding().setCpc(Math.ceil(placement.bidding().getCpc() * 0.2 * 100)/100)};
   if(totalCost[i] < 40 &&  totalCost[i] > 25 && totalLeads[i] == 0){placement.bidding().setCpc(Math.ceil(placement.bidding().getCpc() * 0.5 * 100)/100)};
     }   
}
      }
}  

Tyler Sidell (AdWords Scripts Team)

unread,
Mar 1, 2016, 11:41:20 AM3/1/16
to AdWords Scripts Forum
Hi Marius,

I've tried the script in additional accounts and did not receive that error.  Would you mind sending your CID (reply privately to the author) along with the name of your script so that we can take a look further?

Thanks,
Tyler Sidell
AdWords Scripts Team
Message has been deleted

Sander

unread,
Mar 1, 2016, 11:56:10 AM3/1/16
to AdWords Scripts Forum
Does it maybe happen if you have an original bidding of $0.01? (or $0.02)

m.b...@medidate.de

unread,
Mar 1, 2016, 12:03:28 PM3/1/16
to AdWords Scripts Forum
Unfortunately no. It gives me the error for all values I want to change. If i preview the script everything works fine...

m.b...@medidate.de

unread,
Mar 14, 2016, 7:25:24 AM3/14/16
to AdWords Scripts Forum
Still no progress. Any Ideas?

testing test

unread,
Apr 25, 2016, 9:29:08 AM4/25/16
to AdWords Scripts Forum
Hello Tyler, I wonder If you have figured out what to do with that error?

вторник, 1 марта 2016 г., 19:41:20 UTC+3 пользователь Tyler Sidell (AdWords Scripts Team) написал:

Anash Oommen

unread,
Apr 26, 2016, 11:39:38 AM4/26/16
to AdWords Scripts Forum
I realized that I did a private reply, so posting my reply publicly for future reference.

You cannot change the bids of an automatic placement, only the bid of a managed placement may be changed. When you assign a bid to a placement in the UI, it first converts that placement from automatic to managed if required, and then assigns the bid. Your script needs to do that as well.

1) check if a placement returns isManaged(): true.
2) If yes, set the bid directly.
3) if not, create a new placement with that same URL and then set the bid.

The code snippet would look as follows:

if (!placement.isManaged()) {
  var placementOperation = adGroup.display()
      .newPlacementBuilder()
      .withUrl(placement.getUrl())  // required
      .build();
  placement = placementOperation.getResult();
}

placement.bidding().setCpc(xxx);

Cheers,
Anash P. Oommen,
AdWords Scripts Team.
Reply all
Reply to author
Forward
0 new messages