Zombie SKUs

1,671 views
Skip to first unread message

vicky campbell

unread,
Jan 16, 2023, 4:04:02 AM1/16/23
to Google Ads Scripts Forum
Hi, 

Hope you're good.

I'm using a simple Zombie SKUs script in my account (i've just censored out the google sheet and the merchant id for the purpose of this, happy to share that privately ):

  // Copy the link of the new sheet and paste it below -
var SPREADSHEET_URL = "https://docs.google.com/spreadsheets/example";

// Enter your filters below, for multiple filters use AND clause. E.g. Impressions > 100 AND
// Currently default filter is Clicks < 1 i.e. Zero Clicks

var FILTERS = "Clicks < 2 AND MerchantId = XXXXX";

// Enter time duration below. Possibilities:
// TODAY | YESTERDAY | LAST_7_DAYS | LAST_WEEK | LAST_BUSINESS_WEEK |
// LAST_14_DAYS | LAST_30_DAYS | THIS_WEEK_SUN_TODAY |
// Currently default time duration is set to: LAST_30_DAYS
var TIME_DURATION = "LAST_30_DAYS";
var COUNT_LIMIT = 10000;

function main(){
 
  var products = getFilteredShoppingProducts();
  products.sort(function(a,b){return a[0] > b[0];});
  products = products.slice(0, COUNT_LIMIT);
  pushToSpreadsheet(products);
 
}

function getFilteredShoppingProducts(){
  var query = "SELECT OfferId FROM SHOPPING_PERFORMANCE_REPORT WHERE " + FILTERS + " DURING "+ TIME_DURATION;
 
  var products = [];
  var count = 0;
  var report = AdWordsApp.report(query);
  var rows = report.rows();
  while (rows.hasNext()){
    var row = rows.next();
    var offer_id = row['OfferId'].toString();
    products.push([offer_id]);
    count+= 1;
  }
  Logger.log(count);
  return products;
}

function pushToSpreadsheet(data){
var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet = spreadsheet.getSheetByName('Sheet1');
var lastRow = sheet.getMaxRows();
sheet.getRange('A2:A'+lastRow).clearContent();
var start_row=2;
var endRow=start_row+data.length-1;
var range = sheet.getRange('A'+start_row+':'+'A'+endRow);
if (data.length>0){range.setValues(data);}
return;
}


I have 2 primary feeds in my Google Merchant Center, is there anyway I can apply this feed to just work on 1 of the feeds?

Thanks
Vicky

Google Ads Scripts Forum

unread,
Jan 17, 2023, 3:13:21 AM1/17/23
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/c-dRhLsjxRc) from the forum as it wasn't routed to our support queue.

Regards,
Yasmin
Google Ads Scripts Team

Google Ads Scripts Forum Advisor

unread,
Jan 17, 2023, 5:27:58 AM1/17/23
to adwords...@googlegroups.com

Hi Vicky,

 

Thank you for reaching out to us. This is Yasmin from the Google Ads scripts team. Please excuse us for only getting back now as your message failed to be routed to our support queue.

 

Upon checking the script, it appears that you are using the old version of the Low Volume SKU script. Please note that what you are aiming for isn't possible given the current script you are using since the SHOPPING_PERFORMANCE_REPORT report only checks products in your shopping campaigns. I would suggest you use the Shopping Content service. You may check this link for more information on the Advanced APIs in Google Ads Scripts.

 

On that note, if you would need further assistance, and since this script is outside our scope, I would recommend you reach out to the author of the script as they would be better equipped to provide assistance to a script in which they created.

 

Best regards,

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2hzAps:ref
Reply all
Reply to author
Forward
0 new messages