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

A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

I have applied this script:

http://searchengineland.com/heres-free-adwords-script-pauses-duplicate-broad-keywords-233381

... to get 175 errors and this explanation when I run it:

 

 

"Cannot retrieve the next object: iterator has reached the end. (line 231)"

 

Does anyone have any idea what should I do about it....? 

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Kasia I
November 2015

Re: A "script that pauses duplicate keywords" issue

Top Contributor
# 7
Top Contributor

Hi @Kasia I try @petebardo's first solution first...

 

At line 213, where it currently says:

keywordIterator.next().applyLabel(KEEP_LABEL);

replace this with these three lines:

while(keywordIterator.hasNext()) {
keywordIterator.next().applyLabel(KEEP_LABEL);
}

and you should find the error goes away...

 

Jon

 

 

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

View solution in original post

Re: A "script that pauses duplicate keywords" issue

Top Contributor
# 2
Top Contributor

Hi @Kasia I, it's kind of hard to diagnose the problem because the script as posted only has 226 lines.  If you're seeing an error on line 231 it must have been modified in some way on your Account.

 

Can you post the script you're actually using?

 

Jon

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

Re: A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆
Hi, thanks Smiley Happy I just made a mistake in numbers Smiley Sad The line is 213....

Re: A "script that pauses duplicate keywords" issue

Top Contributor
# 4
Top Contributor
Hi Kasia I,

That line in the code calls keywordIterator.next() without test to see if there is a next. I'm guessing maybe you have 175 campaigns and this registers an error when you get to the end of the keyword list. You could do something like this:

if (keywordIterator.hasNext()) {
keywordIterator.next().applyLabel(KEEP_LABEL);
}

I have no idea how will affect other parts of the script, so test, test, test!

Best of Luck!

Pete
petebardo -- Deadhead doing AdWords

Re: A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 5
Follower ✭ ☆ ☆
Thanks Smiley Happy At which line I should add this....? (I am not a code monkey)

Re: A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 6
Follower ✭ ☆ ☆
I have run the script at a smaller account and it works fine. The error shows up only at a bigger account. It looks like this advice makes also sense:

"Try running the script multiple times using CAMPAIGN_INCLUDE_FILTER and CAMPAIGN_EXCLUDE_FILTER to look at different campaigns each time."

How do I apply CAMPAIGN_INCLUDE_FILTER to make the script run in just one campaign (say xyz campaign)?
Marked as Best Answer.
Solution
Accepted by topic author Kasia I
November 2015

Re: A "script that pauses duplicate keywords" issue

Top Contributor
# 7
Top Contributor

Hi @Kasia I try @petebardo's first solution first...

 

At line 213, where it currently says:

keywordIterator.next().applyLabel(KEEP_LABEL);

replace this with these three lines:

while(keywordIterator.hasNext()) {
keywordIterator.next().applyLabel(KEEP_LABEL);
}

and you should find the error goes away...

 

Jon

 

 

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

Re: A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 8
Follower ✭ ☆ ☆
The error went away, thx Smiley Happy

Re: A "script that pauses duplicate keywords" issue

Top Contributor
# 9
Top Contributor

Hi @Kasia I, did you get the Include and Exclude aspects of the script working?

 

Jon

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

Re: A "script that pauses duplicate keywords" issue

Follower ✭ ☆ ☆
# 10
Follower ✭ ☆ ☆
Yes, it is working - thank you very much for your help Smiley Happy