AdWords
3.8K members online now
3.8K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

how can i turn around a script limit?

i'm trying to update prices on the ads dynamically but im getting a error message in Logs saying "Cannot fetch more AdWords entities from iterator: exceeded limit of 50000"

does anyone know how can i turn around this one?

 

thx

1 Expert replyverified_user

Re: how can i turn around a script limit?

Community Manager
# 2
Community Manager
Hi Rui,

Happy to help but could you send a screenshot of the erroe message and the page on which you are seeing this?

Thanks,
Mini

Re: how can i turn around a script limit?

Top Contributor
# 3
Top Contributor

Hi Rui, the limits on the iterators are fixed so there's no option to increase them.


What you'll need to do is find a way to reduce the size of the iterators using conditions and then loop through them.  For example, if you were trying to select all the Keywords in an Account (I don't think you are, because the Keyword limit is 75,000) and there were too many in a single iterator, you could use a Campaign iterator and nest a Keyword iterator within that so that each individual Keyword iterator is below the limit.

 

Just as an extra tip, this situation is one of the reasons I usually write scripts with the main "work" part of the script as it's own function.  This makes it easier to create conditional loops that call this function and vary the size and nature of the loops without getting confused by the actual code that does something.  For example:

 

function main() {

  var campIterator = AdWordsApp.Campaigns()

    .withCondition(...)

    .get();

 

  // this bit loops round

  while(campIterator.hasNext()) {

    var thisCampaign = campIterator.next();

    

    workFunction(thisCampaign);

  }

}

 

function workFunction(aCampaign) {

  //this bit does the actual work

}

 

Jon

 

 

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Hi Mini,
thank you for your reply
here is the script:


var SPREADSHEET_URL = "https://docs.google.com/spreadsheets/d/13PbDHrRyze85gGZQ1X-LH9wBCE3aNIJEU0M_iuVbbZY/edit#gid=9105214... ";
var SET_PARAM1 = true;
var DATA_RANGE = 'A:C';

function main() {
var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var allSheets = spreadsheet.getSheets();
var allData = [];
for(var i in allSheets) {
var sheet = allSheets[i];
var data = sheet.getRange(DATA_RANGE).getValues();
data.shift();
allData = allData.concat(data);
}

var allDataHash = {};
for(var i in allData) {
var row = allData[i];
if(row[0] === '') { continue; }
var rowKey = [row[0],row[1]].join('~~!~~');
allDataHash[rowKey] = { param1 : row[2] };
}

var kwIter = AdWordsApp.keywords()
.withCondition('CampaignStatus = ENABLED')
.withCondition('AdGroupStatus = ENABLED')
.withCondition('Status = ENABLED')
.get();

while(kwIter.hasNext()) {
var kw = kwIter.next();
var campName = kw.getCampaign().getName();
var adGroupName = kw.getAdGroup().getName();
var rowKey = [campName,adGroupName].join('~~!~~');
if(allDataHash[rowKey]) {
if(SET_PARAM1) { kw.setAdParam(1, allDataHash[rowKey].param1); }
}
}
}


thanks
rui

Re: how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
appreciated the tip Jon
i will try the way you recommended

thanks
rui

Re: how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Hi Rui,

I have the same problem, did you get it to work? Where in the script did you do the changes?

Dan

Re: how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hi,

another possibility is the use of labels to tag entities that have already been processed:
https://developers.google.com/adwords/scripts/docs/tips

Andreas

Re: how can i turn around a script limit?

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

Hi ,

 

Did anyone get solution for using dynamic values wherein Limit cross 50000? im also getting log error 

Cannot fetch more AdWords entities from iterator: exceeded limit of 50000.

 

Pls help adwords community team.

 

Many thanks,

Arti 

Re: how can i turn around a script limit?

Top Contributor
# 9
Top Contributor

Hi @Arti K you should find the solution in the answers in this thread.

 

In short, the answer is to find a way to reduce the number of objects you're selecting into separate "pieces" then process those pieces one at a time.  For example, if you're selecting Keywords, try selecting them alphabetically, or by number of clicks, and do this in a loop until you've covered them all.

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits