Is there a way to track Search Volume in a specific Industry?

89 views
Skip to first unread message

Pim Westervoorde

unread,
Jan 16, 2023, 4:04:02 AM1/16/23
to Google Ads Scripts Forum
Is there a way to track Search Volume in a specific Industry? I will use a Google Ads script: 

var API_KEY = 'xx';
var SERVICE = AdsApp.ads();
SERVICE.getAuth().setApiKey(API_KEY);


function main() {
    // Get the keywords in the account
    var keywords = AdsApp.keywords().get();
    var spreadsheet = SpreadsheetApp.create('Weekly Keyword Search Volume');
    var sheet = spreadsheet.getActiveSheet();

    // Add headers to the spreadsheet
    sheet.appendRow(['Keyword', 'Week', 'Search Volume']);

    // Loop through the keywords and get the search volume
    while (keywords.hasNext()) {
        var keyword = keywords.next();
        var searchVolume = keyword.getSearchVolume();
        var week = new Date().getWeek();

        // Add the keyword, week, and search volume to the spreadsheet
        sheet.appendRow([keyword.getText(), week, searchVolume]);
    }
}

However, I'll get TypeError: SERVICE.getAuth is not a function (line 3). How to solve this?

Google Ads Scripts Forum

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

Cheers, 
James
Google Ads Scripts Team

Google Ads Scripts Forum Advisor

unread,
Jan 20, 2023, 5:05:44 AM1/20/23
to adwords...@googlegroups.com

Hello,

Thank you for reaching out to us.

Based on the given code snippet, it appears that you’re trying to call a specific method which is not supported by the AdsApp.ads object. Take note that the getAuth and setApiKey are methods that are not supported by the said object. That’s the main reason why you received the not a function error upon running the said script in your end. 

Please note that the methods stated on this guide are the only supported methods of AdsApp.ads object.

Let me know if you have any questions.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


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