segments.ad_network_type returns int value but

132 views
Skip to first unread message

Andrey Buhovetskiy

unread,
Feb 26, 2022, 7:29:15 AM2/26/22
to Google Ads API and AdWords API Forum
Hi,
Try to get ad_network_type like enum (CONTENT,MIXED, etc.)
documentation

query = f"""
SELECT
segments.date,
campaign.name,
campaign.id,
ad_group.name,
ad_group.id,
metrics.impressions,
metrics.clicks,
metrics.ctr,
metrics.conversions,
metrics.conversions_value,
metrics.interactions,
metrics.interaction_rate,
metrics.average_cpc,
metrics.cost_micros,
customer.currency_code,
customer.id,
geographic_view.country_criterion_id,
geographic_view.location_type,
segments.ad_network_type
FROM geographic_view
WHERE segments.date BETWEEN '{arrow.get(start).format('YYYY-MM-DD')}' AND '{arrow.get(end).format('YYYY-MM-DD')}'"""

response processing:
return [
{
"date": row.segments.date,
"campaign_name": row.campaign.name,
"campaign_id": row.campaign.id,
"ad_group_name": row.ad_group.name,
"ad_group_id": row.ad_group.id,
"impressions": row.metrics.impressions,
"clicks": row.metrics.clicks,
"ctr": row.metrics.ctr,
"average_cpc": row.metrics.average_cpc,
"cost_micros": row.metrics.cost_micros,
"currency_code": row.customer.currency_code,
"customer_id": row.customer.id,
"country_criterion_id": row.geographic_view.country_criterion_id,
"location_type": int(row.geographic_view.location_type),
"conversions": row.metrics.conversions,
"conversions_value": row.metrics.conversions_value,
"interactions": row.metrics.interactions,
"interaction_rate": row.metrics.interaction_rate,
"ad_network_type": row.segments.ad_network_type
}
for row in response
]

 but it returns a numeric value (2). How can I get text value (for example SEARCH)?Снимок экрана 2022-02-26 в 15.14.05.png

Google Ads API Forum Advisor

unread,
Feb 28, 2022, 3:32:09 AM2/28/22
to andrey.bu...@gismart.com, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API forum.

Kindly note that the retrieved numerical value of the enum will vary depending on the client library that you’re using to get it. Since you mentioned that your response returns a numeric value (2) for the python client library, with this, I recommend you to reach out to the Python client library owner by filing an issue on the issue tracker on the Issue tab of your client library on the github, so that they can provide guidance on it.  Also, we recommend that you use the enum instead of their code.

Let us know if you have any further questions.

Regards,

Google Logo
Yasar
Google Ads API Team
 

 

 



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