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

adwords scripts not working

Follower ✭ ✭ ✭
# 1
Follower ✭ ✭ ✭

Hi folks,

 

I'm having a doozy of a problem in an Enterprise level account. I'm trying to apply a script and the interface is getting caught saving. It just loops on save with no logs and then erases the script. I've tried incognito mode, logging out of other accounts, clearing caches, everything. I have admin level access, so everything should work.

 

Possibly related, possibly nothing: my existing script is sending runtime errors and not actually running. What can I try to make this work?

 

cheers,

Julia

1 Expert replyverified_user

Re: adwords scripts not working

Top Contributor
# 2
Top Contributor

Hi @Julia V the problem with script not saving is, I think, unrelated to the runtime error on the other script.  From time to time I'll find the UI will hang so I'm hoping that it's just one of these examples.  Is it still happening today?

 

On the offchance that the problem is related to the other script and its errors, let's try and solve that first.  Can you post what the actual error is, and, if possible, details of the script itself?

 

Jon

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

Re: adwords scripts not working

Follower ✭ ✭ ✭
# 3
Follower ✭ ✭ ✭
Hi @Jon_Gritton thanks for taking this up!

In between time, I actually got an answer from the client's vertical team. They've never encountered this type of error before, and have moved through to engineering for a more detailed look.

The current situation is that it's happening today. Here is the version of the script I'm attempting to apply. It's a little old, but a colleague used it a few weeks ago in another account without issue. http://www.ppc-epiphany.com/2013/01/26/adwords-quality-score-tracker-version-2-0-now-with-labels/

The general idea is to target changes in the QS of specific keywords, which can help give insight into the quality of new landing pages related to those keywords.

At present I'll ignore the runtime error. I get an error related to this script on line 37 (invalid return) and a refusal to save, with no logs created. It's a real headache, if you have any insights or ideas I could try, I'd really appreciate it.

cheers,
Julia

Re: adwords scripts not working

Top Contributor
# 4
Top Contributor

Hi @Julia V well, at least one thing is simple.  Line 37 is in this bit of code:

 

  if(line_counter == 0){
    Logger.log("Couldn't find any keywords marked for quality score tracking. and there's more...);
    return;
  }

The problem is the "return" in this bit of code appears within the main() function, which is the primary function of scripts so there's nowhere for the routine to return to.  The best solution is to actually make the code a little more user-friendly and not use the main() function to hold all the code.  Rewrite the first few lines that currently say this:

var email_address = "YOUR_EMAIL_HERE"; // Change this to be notified of changes
var label_name = "Track QS";

function main() {
  var labelIterator = AdWordsApp.labels().withCondition("Name = '" + label_name + "'").get();
  // If there is no label, this is the first time this script is running

to this:

var email_address = "YOUR_EMAIL_HERE"; // Change this to be notified of changes
var label_name = "Track QS";

function main() {
  doQSCheck();
}

function doQSCheck() {
  var labelIterator = AdWordsApp.labels().withCondition("Name = '" + label_name + "'").get();
  // If there is no label, this is the first time this script is running

and it should all spring into life (well, it'll solve that return error, I can't say if there are any others!).  Now, when the script runs it'll run main() which will call doQSCheck() and when the return is triggered it'll be able to return to main() without an error.

 

It's better practice to use the main() function as a top-level set of steps in a script rather than being the "workhorse" of the code.  Doing this allows you to add new functions easily and leads towards a more structured approach than having all the code in one huge block as the original was.  Of course, it also allows you to use the return function more efficiently!

 

Jon

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

Re: adwords scripts not working

Follower ✭ ✭ ✭
# 5
Follower ✭ ✭ ✭

 

Hi Jon,

I really appreciate your taking the time to look into this, and for suggesting a code rewrite, I could not have done that myself!

Sadly all this does is move the return error down to line 41, and it still won't save. Images won't load in this thread, but I can share it with you on Google+ if you want to see what it looks like.

 

I did hear back from the vertical team, and they suggested I remove all instances of KeywordText and change that to Criteria. Unfortunately, there are no instances of KeywordText in the script, so I'm left wondering if they just sent a generic answer based on the error type without actually looking at it.

My colleague has never seen anything like this either, so I'm starting to feel like it's a bigger issue than this one script. I'm going to test out very basic scripts and see if on the whole they're not succeeding, and maybe find out if there's some kind of bigger issue.

 

 

Re: adwords scripts not working

Top Contributor
# 6
Top Contributor

Hi @Julia V sorry about that, there's actually a second error in the script (my bad for trying to be too clever and quick with my diagnosis!).  The author has an extra closing bracket "}" which needs to be removed.  It wasn't showing as an error until I actually removed the "return".  Where the code says this:

    // Store the current QS for the next time by using a label
    keyword.applyLabel("QS: " + current_quality_score);
  }
  
  if(line_counter == 0){
    Logger.log("Couldn't find any keywords marked for quality score tracking. To mark keywords for tracking, apply the label '" + label_name + "' to those keywords.");
    return;
  }

Remove the } from just below the line keyword.appyLabel("...  It looks wrong when laid out because the author has "hidden" several lines of code within one long one further up the page.  This chunk of code should now look like:

    // Store the current QS for the next time by using a label
    keyword.applyLabel("QS: " + current_quality_score);
  
  if(line_counter == 0){
    Logger.log("Couldn't find any keywords marked for quality score tracking. To mark keywords for tracking, apply the label '" + label_name + "' to those keywords.");
    return;
  }

Interestingly, the script as published on the site could never have worked with this error...

 

As an aside, the not saving issue is a "feature" of scripts.  You can't save a script with any errors in it.  I can understand why, to some degree, but it's a bit of a pain when you're trying to build a large script and want to quit for the day Smiley Happy

 

Jon

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