[ZombieSKU ID is not working]

58 views
Skip to first unread message

Csaba Bálint

unread,
Aug 23, 2022, 6:56:09 AM8/23/22
to Google Ads API and AdWords API Forum
Dear Google,

I have a script that doesn't work in the new expreience. 
Here is the script:

// Copy the link of the new sheet and paste it below -
var SPREADSHEET_URL = "https://docs.google.com/spreadsheets/d/1hWwzTXhH163YIATbMUMvEmwZx5OAMXoczqMM337xYw0/edit#gid=0";
// 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 = "Conversions < 1 AND Cost > 10";
var FILTERS = "metrics.clicks < 1"
// Enter time duration below. Possibilities:
// TODAY | YESTERDAY | LAST_7_DAYS | LAST_WEEK | LAST_BUSINESS_WEEK |
//THIS_MONTH | LAST_MONTH |
// LAST_14_DAYS | LAST_30_DAYS | THIS_WEEK_SUN_TODAY |
//THIS_WEEK_MON_TODAY | LAST_WEEK_SUN_SAT
// Currently default time duration is set to: LAST_30_DAYS
var TIME_DURATION = "LAST_30_DAYS";
var COUNT_LIMIT = 999999;
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, Cost, Conversions FROM shopping_performance_view WHERE " +
  FILTERS + " DURING "+ TIME_DURATION;
  */
 
  var query = "SELECT segments.product_item_id, metrics.cost_micros, metrics.conversions FROM shopping_performance_view WHERE " + FILTERS + " AND segments.date 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'];
        products.push([offer_id]);
        count += 1;
    }
    Logger.log(count);
    return products;
}
function pushToSpreadsheet(data) {
    var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
    var sheet = spreadsheet.getSheetByName('Custom_Label');
    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;
}

Main problem with script is spreadsheet is blank. The script dont able to push my product ID to the spreeadsheet.

Could you help me?

Thanks!

Google Ads API Forum Advisor

unread,
Aug 23, 2022, 8:18:48 AM8/23/22
to balint.c...@gmail.com, adwor...@googlegroups.com
Hi Csaba,

Thank you for reaching out to us.

It seems that your concern is in scripts.

That said, I would suggest you reach out to the Google Ads Scripts team via this link instead, as they should be more equipped to provide guidance on this matter.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2dmeB9:ref

Csaba Bálint

unread,
Aug 25, 2022, 3:59:03 AM8/25/22
to Google Ads API and AdWords API Forum
Hi Heidi,

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages