Updating Pause Script for low Quality Score Keywords

334 views
Skip to first unread message

Addison Nash

unread,
Feb 16, 2016, 9:26:54 AM2/16/16
to AdWords Scripts Forum
Hello, obviously I didn't write this but I want to modify it to make it work, it's supposed to pause Keywords with a lower QS than 6

Hello, I found a nice script that I wanted to update to work with the current Adwords API. 
I updated two things on this script before posting, changing "Keyword" to Criteria (it was reporting an error on line 31 before I did this
And changing "Active" to "Enabled" it was reporting an error before changing this.
Yet this script is lacking something. It's supposed to pause keywords that have a lower QS than 6 but I don't see a pause command, I tested it with KW that have 5 or lower score and it does email me a google spreadsheet with those keywords but it doesn't pause them.

Am I missing something?
Thanks!


// Copyright www.optmyzr.com all rights reserved. This script is provided on a as-is basis with no guarantee.
// This script may be distributed freely, without changing this notice

function main() {
 
  //EDIT- SECTION
 
  //Enter email address. For mulitple addresses please enter the the addresses separated by a comma.
  var email_address = "exa...@email.com";
 
  //Change the pause value to true to pause the keywords with below quality score.
  var pause = true;
 
  //This quality score defines the threshold to find keywords below it.
  var quality_score = 6;
 
  //ENTER the number of days you would like to get the stats of keywords for. By default it checks for last 30 days.
  var date_range = "LAST_30_DAYS";
 
  //END OF EDIT-SECTION
 
  var workbook = SpreadsheetApp.create("Keywords with low Quality Score (" +
    Utilities.formatDate(new Date(), "PST", "MM-dd HH:mm)"));
  var currentSheet = workbook.getActiveSheet();
  var keyword_found=false;
 
  currentSheet.setName("Overview");
  currentSheet.appendRow(["Campaign Name","Adgroup","Criteria","Cost","Impressions","Conversions","Quality Score"]);
  currentSheet.getRange("1:1").setFontWeight("bold");
 
  var report = AdWordsApp.report("SELECT CampaignName, AdGroupName, Criteria, Cost, Impressions, Conversions, QualityScore "+
                                "FROM KEYWORDS_PERFORMANCE_REPORT "+
                                 "WHERE CampaignStatus= ENABLED and AdGroupStatus = ENABLED and Status = ENABLED and QualityScore<"+quality_score+
                                " DURING "+date_range);
 
  report.exportToSheet(currentSheet);
  var rows = report.rows();
  if(!rows.hasNext()){
   currentSheet.appendRow(["No active Keywords Found"]);
  } 
 
  MailApp.sendEmail(email_address, "Quality Score Tracker for Keywords", "You can see the keywords on the following url\n\n"+workbook.getUrl());
}      

Tyler Sidell (AdWords Scripts Team)

unread,
Feb 16, 2016, 10:59:45 AM2/16/16
to AdWords Scripts Forum
Hi Addison,

I see that setting the var pause = true; is supposed to pause the keywords but I'm not seeing this variable called anywhere in the script itself. I would recommend reaching out to Ooptmyzr support as well.  You would need to call Keyword.pause() in this script in order to pause the keywords.

Thanks,
Tyler Sidell
AdWords Scripts Team

AussieWeb Conversion

unread,
Feb 19, 2016, 1:13:56 AM2/19/16
to AdWords Scripts Forum
Hi Addison

It appears the script you posted merely reports on the keywords with quality score below your threshold,
rather than actually pause them (despite it's claim to do so).

I'd use this code or similar
 var keywordSelector = AdWordsApp
     
.keywords()
     
.withCondition("Status = ENABLED")
     .withCondition("QualityScore <= 4")
     
.forDateRange("LAST_MONTH");

 
var keywordIterator = keywordSelector.get();
 
while (keywordIterator.hasNext()) {
   
var keyword = keywordIterator.next();
   
Logger.log("Pausing " + keyword.getText());
   keyword
.pause();
 
}

NB - The above is untested, so use with caution.
Regards
Nigel

Rafał Ciok

unread,
Jan 9, 2018, 10:29:49 AM1/9/18
to AdWords Scripts Forum
I think this error is due to a glitch in .pause() operation. We struggle with it for a couple of days. 
Reply all
Reply to author
Forward
0 new messages