Hi team,

I need to get the ad_strength by Ads API but it returned UNSPECIFIED which 
does not match the UI(ss <https://screenshot.googleplex.com/6ynqwAEhPtHkY2q>). 
The UI shows POOR for ad group 103163743641.

The API returns:
Ad group with ID 103163743641 and strength "UNSPECIFIED" was found in 
campaign with ID 9730043446.


The script is:

def main(client, customer_id, page_size, campaign_id=None):
ga_service = client.get_service("GoogleAdsService", version="v6")
campaign_status_enum = client.get_type('AdStrengthEnum')

query = """
select campaign.id, ad_group_ad.ad.id, ad_group.id, ad_group_ad.ad_strength 
from ad_group_ad """

if campaign_id:
query = "%s WHERE campaign.id = %s" % (query, campaign_id)

results = ga_service.search(customer_id, query=query, page_size=page_size)

try:
for row in results:
print(
'Ad group with ID %d and strength "%s" was found in campaign '
"with ID %d."
% (row.ad_group.id, 
campaign_status_enum.AdStrength.Name(row.ad_group_ad.ad_strength), 
row.campaign.id)
)
except google.ads.google_ads.errors.GoogleAdsException as ex:
print(
'Request with ID "%s" failed with status "%s" and includes the '
"following errors:" % (ex.request_id, ex.error.code().name)
)
for error in ex.failure.errors:
print('\tError with message "%s".' % error.message)
if error.location:
for field_path_element in error.location.field_path_elements:
print("\t\tOn field: %s" % field_path_element.field_name)
sys.exit(1)

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/aeb07a09-5e4b-4ce7-9846-4bc89f948009n%40googlegroups.com.
  • Why ad_group_ad.ad_st... 'Dong Chen' via AdWords API and Google Ads API Forum

Reply via email to