How to include LabelIds and Labels in Ad Peformance Reporting?

165 views
Skip to first unread message

Marvin Laskov

unread,
Nov 3, 2021, 1:10:02 AM11/3/21
to AdWords API and Google Ads API Forum

I am trying to create a report for Extended Text Ads using Google Ads API in the python language.

I was able to do this for my reporting using Adwords API whereby I selected labels and labelids in the columns field.

cols = [ 'AccountDescriptiveName', 'AdGroupId', 'AdGroupName', 'AdGroupStatus', 'AdNetworkType2', 'AdType', 'CampaignId', 'CampaignName', 'CampaignStatus', 'Clicks', 'Conversions', 'Cost', 'CreativeFinalUrls', 'Description', 'ExpandedTextAdDescription2', 'HeadlinePart1', 'HeadlinePart2', 'ExpandedTextAdHeadlinePart3', 'Id', 'Impressions', 'LabelIds', 'Labels', 'Path1', 'Path2', 'Status' ]

sel = create_selector( cols, pred_fields=['Status', 'CampaignStatus', 'AdGroupStatus', 'AdNetworkType2', 'AdType'], pred_operators=['EQUALS', 'EQUALS', 'EQUALS', 'EQUALS', 'EQUALS'], pred_values=['ENABLED', 'ENABLED', 'ENABLED', 'SEARCH', 'EXPANDED_TEXT_AD'])

df = get_report_as_df( client, selector=sel, report_type='AD_PERFORMANCE_REPORT', date_range_type='LAST_30_DAYS', )

However, from what I understand the new GAQL approach requires using the ad_group_ad resource which does not have labelids and labelname inside? I know there is a ad_group_ad_label resource however, I am not sure how I can make use of it. Also https://developers.google.com/google-ads/api/docs/migration/mapping#ad_performance tells me that I should "Select label.resource_name from the resource ad_group_ad_label" but as GAQL queries only allow retrieval of one resource how do I go about it?

Currently I have these in my GAQL Query

SELECT customer.descriptive_name, ad_group.id, ad_group.name, ad_group.status, ad_group_ad.ad.type, campaign.id, campaign.name, campaign.status, metrics.clicks, metrics.conversions, metrics.cost_micros, ad_group_ad.ad.final_urls, ad_group_ad.ad.expanded_text_ad.description, ad_group_ad.ad.expanded_text_ad.description2, ad_group_ad.ad.expanded_text_ad.headline_part1, ad_group_ad.ad.expanded_text_ad.headline_part2, ad_group_ad.ad.expanded_text_ad.headline_part3, ad_group_ad.ad.id, metrics.impressions, ad_group_ad.ad.expanded_text_ad.path1, ad_group_ad.ad.expanded_text_ad.path2, ad_group_ad.status FROM ad_group_ad WHERE ad_group_ad.status = ENABLED AND campaign.status = ENABLED AND ad_group.status = ENABLED AND ad_group_ad.ad.type = EXPANDED_TEXT_AD

Google Ads API Forum Advisor

unread,
Nov 3, 2021, 11:32:03 AM11/3/21
to marvin...@gmail.com, adwor...@googlegroups.com
Hi Marvin,

Thanks for reaching out. The labels attribute you mentioned returns the resource name of the label attached to the entity. The resource name contains the label ID, in the form: customers/{customer_id}/labels/{label_id}

You can read more about Ads API reporting with labels here.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QHWjk:ref

Marvin Laskov

unread,
Nov 4, 2021, 10:23:47 PM11/4/21
to AdWords API and Google Ads API Forum
Hi Matt,

Thanks for the reply, my aplogies I am able to get the label_id querying the ad_group_ad resource, however I am unable to obtain the label name which is more useful for my reporting.
I have recently discovered that I would be able to get the label name by querying the label resource then match the label id to retrieve the label names I require, however I would like to know if there is an easier more straightforward approach? Also will it be possible to include the label name in ad_group_ad resource in future versions?

Sincerely,
Marvin Laskov 

Google Ads API Forum Advisor

unread,
Nov 5, 2021, 3:38:40 AM11/5/21
to marvin...@gmail.com, adwor...@googlegroups.com
Hi Marvin,

I work with Matt and let me provide support to your concern.

If what you are looking for is a report type only that can get the ads and the labels associated to it, then you can use the ad_group_ad_label and include the fields of the label resource that you needed.

Let me know if you have further questions.

Regards,

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QHWjk:ref

Marvin Laskov

unread,
Nov 7, 2021, 10:51:41 PM11/7/21
to AdWords API and Google Ads API Forum
Hi Ernie,

Thanks for that, it was really helpful.

Sincerely,
Marvin Laskov

VB

unread,
May 19, 2023, 9:30:06 AM5/19/23
to Google Ads API and AdWords API Forum
Hi Ernie, 

had the same problem and tried to use  ad_group_ad_label.name in my select clause, but it didn't work. Did I misunderstood the solution? Currently I use ad_group_ad.labels and get ID, which is not helful, unfortunately.

Thank you!

Google Ads API and AdWords API Forum

unread,
May 19, 2023, 4:29:24 PM5/19/23
to Google Ads API and AdWords API Forum
Re-posting the last inquiry (https://groups.google.com/g/adwords-api/c/5UdI6f_1yWYfrom the forum as it wasn't routed to our support queue.

Regards,
Google Ads API Team

Google Ads API and AdWords API Forum

unread,
May 19, 2023, 5:14:52 PM5/19/23
to Google Ads API and AdWords API Forum
Hi,

Thank you for reaching out to our team.

Regarding your concern, can you please provide more context about this so we can have a better view and can provide precise recommendations? Also, in order for our team to further investigate this issue on our end, can you provide the complete request and response logs with request ID and request header generated on your end? Kindly note that we will be needing this so that we can better check and investigate this issue.
 
You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Ads API Team
On Friday, May 19, 2023 at 9:30:06 PM UTC+8 VB wrote:
Reply all
Reply to author
Forward
0 new messages