Keyword Labels

193 views
Skip to first unread message

Martin Scholz

unread,
Jun 30, 2021, 2:38:27 AM6/30/21
to Google Ads Scripts Forum
Hello,

we are using a script with the following report to get stats from keywords including their assigned labels:

    var report = AdsApp.report(
    'SELECT Criteria, Clicks, Impressions, Labels ' +
    'FROM KEYWORDS_PERFORMANCE_REPORT ' +
    'WHERE Status = ENABLED AND AdGroupStatus = ENABLED AND CampaignStatus = ENABLED ' +
    'AND AdGroupName DOES_NOT_CONTAIN "zz" ' +
     'AND Criteria CONTAINS "atollo" ' +
    'AND AdNetworkType2 = SEARCH ' +
    'AND Device IN ["DESKTOP"] ' +
    'DURING LAST_WEEK ');

Facing the sunset of the AdWords API, we tried the Query Migration Tool, getting this result:

SELECT ad_group_criterion.keyword.text, metrics.clicks, metrics.impressions, ad_group_criterion.labels, segments.ad_network_type, segments.device FROM keyword_view WHERE ad_group_criterion.status = "ENABLED" AND ad_group.status = "ENABLED" AND campaign.status = "ENABLED" AND ad_group.name NOT REGEXP_MATCH ".*zz.*" AND ad_group_criterion.keyword.text REGEXP_MATCH ".*atollo.*" AND segments.ad_network_type = "SEARCH" AND segments.device IN ("DESKTOP") AND segments.date DURING LAST_WEEK_MON_SUN

But "ad_group_criterion.labels" doesn´t seem to be the right attribute, showing only "undefined" results.

Can you get the keyword labels in an report including metrics? 

Thanks!

Greetings
Martin
GAQL-query.PNG
GAQL-report.PNG
AWQL-query.PNG
AWQL-report.PNG

Google Ads Scripts Forum Advisor

unread,
Jun 30, 2021, 5:20:05 AM6/30/21
to adwords...@googlegroups.com
Hi Martin,

Thanks for reaching out to us. Harry here, from the Google Ads Scripts Team.

Kindly provide the script's name and your CID so that I could check this on our end and investigate what caused the issue. You may send them here or privately via the reply to author option. Note that you may need to join the Google Group for you to use this option.
 
If this option is not available at your end still, you may send it through our email (googleadsscr...@google.com) instead.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JXRZb:ref

Google Ads Scripts Forum Advisor

unread,
Jul 1, 2021, 2:22:09 AM7/1/21
to adwords...@googlegroups.com
Hi Martin,

Thanks for providing the requested details. Kindly try to use Google Ads Search instead when using GAQL queries. You can refer to the code below:
  var query = 'SELECT ad_group_criterion.labels FROM keyword_view';

  // The second argument is optional.
  var result = AdsApp.search(query, {apiVersion: 'v8'});
  while (result.hasNext()) {
    var row = result.next();
    // You can log row to see how the results objects are represented
    // Logger.log(row);
    Logger.log(row.adGroupCriterion.labels);
  }
  
If the keywords labels are still not showing, kindly provide the following so I can raise this with the rest of the team:
  • Google Ads UI screenshots showing the expected results
  • Google Ads scripts result
Looking forward to your reply.

Martin Scholz

unread,
Jul 1, 2021, 3:24:30 AM7/1/21
to Google Ads Scripts Forum on behalf of adsscripts

Hello Harry,

 

thanks a lot! Now it is possible to get the resource name of the label, like „customers/3584302488/labels/10319660".

 

Is it also possible to get the names of the labels?

 

Greetings

Martin

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/xDkRBQ27glY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/XpfWC000000000000000000000000000000000000000000000QVJZ0P00gX1iETCxTtGYyFNnKklQDw%40sfdc.net.

Google Ads Scripts Forum Advisor

unread,
Jul 1, 2021, 5:38:34 AM7/1/21
to adwords...@googlegroups.com
Hi Martin,

Glad that worked. You can retrieve the label resource filtered with the keyword resource name field from the keyword_view resource.

Martin Scholz

unread,
Jul 1, 2021, 6:13:18 AM7/1/21
to Google Ads Scripts Forum
Thanks for your quick response.

Can you explain that further? I don´t know how to connect the label and the keyword_view resource.

Google Ads Scripts Forum Advisor

unread,
Jul 2, 2021, 3:25:07 AM7/2/21
to adwords...@googlegroups.com
Hi there,

I work along with Harry. Allow me to assist you in this.

To elaborate further, since you already have the keyword resource, you need to label resource as mentioned by my colleague. Here is the sample query for your use case:
var query = 'SELECT label.name FROM label WHERE label.resource_name = "customers/3584302488/labels/10319660"';

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JXRZb:ref

Martin Scholz

unread,
Jul 2, 2021, 3:35:57 AM7/2/21
to Google Ads Scripts Forum
Hi Teejay,

thanks, now I got it. Really appreciated your help!
Reply all
Reply to author
Forward
0 new messages