Search code examples
javascriptgoogle-ads-apiawql

Get custom column(s)/field(s) with Google Adwords script


I am currently working on a script to report information on our Ad Groups. We set up some customized columns and it would be great to get them while creating the reports.

A basic code based on the documentation looks like this:

var report = AdWordsApp.report(
    'SELECT CampaignName, AdGroupName, MyCustomColumn ' +
    'FROM   ADGROUP_PERFORMANCE_REPORT ' +
    'WHERE  CampaignName CONTAINS "'+campaign_discriminator+'"');

var rows = report.rows();
while (rows.hasNext()) {
    var row = rows.next();
    Logger.log(JSON.stringify(row));
}

However, I did not find anyway to get the custom column (MyCustomColumn here) in this Adwords Query Language (AWQL) request. I looked around on the web and this question seems not covered, is the answer too obvious or just impossible?

Thank you for any useful input and questions

Best.


Solution

  • It's impossible I am afraid.

    AWQL supports only the report types, columns, etc. defined here: https://developers.google.com/adwords/api/docs/appendix/reports

    You'd need to implement the logic that defines the custom column in your script code