Fetch 'KEYWORD_TEXT', 'CATEGORY_PRODUCTS_AND_SERVICES' columns for a given keyword list

38 views
Skip to first unread message

Toprak Ucar

unread,
Feb 23, 2022, 10:56:29 AM2/23/22
to Google Ads API and AdWords API Forum
Hello,

During the migration of Google Ads Migration, I stuck with the migration of TargetingIdeaService. I want to get 'KEYWORD_TEXT' and 'CATEGORY_PRODUCTS_AND_SERVICES' values.

I tried to apply the example in https://github.com/googleads/google-ads-python/blob/main/examples/planning/generate_keyword_ideas.py, I am having "ValueError: Specified type 'StringValue' does not exist in Google Ads API v10" error using only keyword_texts in the example (I don't use page_url)

In old googleads library (it works):

targeting_idea_service = client.GetService(
'TargetingIdeaService', version=self.config.version
)

selector = {'ideaType': 'KEYWORD',
'requestType': 'STATS',
'requestedAttributeTypes': ['KEYWORD_TEXT', 'CATEGORY_PRODUCTS_AND_SERVICES']}

# Network search parameter (optional)
selector['searchParameters'].append({
'xsi_type': 'NetworkSearchParameter',
'networkSetting': {
'targetGoogleSearch': True,
'targetSearchNetwork': False,
'targetContentNetwork': False,
'targetPartnerSearchNetwork': False
}
})

# Language setting (optional).
selector['searchParameters'].append({
# The ID can be found in the documentation:
# https://developers.google.com/adwords/api/docs/appendix/languagecodes
'xsi_type': 'LanguageSearchParameter',
'languages': [{'id': '1002'}]
})

page = targeting_idea_service.get(selector)

for result in page['entries']:
    attributes = {}
    for attribute in result['data']:
        attributes[attribute['key']] = getattr(
            attribute['value'], 'value', '0')

Thank you so much in advance!

Cheers


Google Ads API Forum Advisor

unread,
Feb 24, 2022, 12:46:04 AM2/24/22
to top...@armis.tech, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API Forum.

For STATS, you may see this page for supported KeywordPlanHistoricalMetrics. However, CATEGORY_PRODUCTS_AND_SERVICES is not a currently supported historical metric. As mentioned in the migration guide, the Business Category has been removed in the Ads API. You may re-try your request without CATEGORY_PRODUCTS_AND_SERVICES

If you still persist with the error, complete request and response logs (along with the request-id) as seen in their respective links via reply author to privately option. If you are using a python client library, you may first enable logging by navigating to the Client libraries > Your client library (select. python) > Logging documentation, which you can access from this link.

Regards,

Google Logo
Yasar
Google Ads API Team
 


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