This is my list of keywords when I use the API to retrieve Search Volume:
- best san francisco walking tour
- best walking tour of san francisco
- best walking tours in san francisco
- francisbest walking tours of san
Results: (I printed them out):
{'KEYWORD_TEXT': 'best san francisco walking tour', 'SEARCH_VOLUME': 140}
{'KEYWORD_TEXT': 'best walking tour of san francisco', 'SEARCH_VOLUME': 140}
{'KEYWORD_TEXT': 'best walking tours in san francisco', 'SEARCH_VOLUME':
140}
{'KEYWORD_TEXT': 'best walking tours of san francisco', 'SEARCH_VOLUME':
140}
======
I input those keyword to Keyword Planner as well, and this is the result
[image: google adwords keyword planner.png]
You can see that there is only 1 keyword here (with 140 SV)
====
This is a problem because if I group all of those 4 keywords to 1 group,
the SV for this group would be (140 * 4 = 560) which doesn't match which
Keyword Planner (140)
Note: My understanding is when KW Planner merges all of those keywords to 1
keyword, then sum SV for all of those 4 keywords would be 140.
Code I'm using to get SV:
def get_keyword_sv(keywords, client=None, ad_group_id=None):
print("start get sv");
if client is None:
client = adwords.AdWordsClient.LoadFromStorage()
# Initialize appropriate service.
targeting_idea_service = client.GetService(
'TargetingIdeaService', version='v201809')
# Construct selector object and retrieve related keywords.
selector = {
'ideaType': 'KEYWORD',
'requestType': 'STATS'
}
selector['requestedAttributeTypes'] = [
'KEYWORD_TEXT', 'SEARCH_VOLUME']
offset = 0
selector['paging'] = {
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
}
selector['searchParameters'] = [{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries': keywords
}]
# 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': '1000'}]
})
# Network search parameter (optional)
selector['searchParameters'].append({
'xsi_type': 'NetworkSearchParameter',
'networkSetting': {
'targetGoogleSearch': True,
'targetSearchNetwork': False,
'targetContentNetwork': False,
'targetPartnerSearchNetwork': False
}
})
# Use an existing ad group to generate ideas (optional)
if ad_group_id is not None:
selector['searchParameters'].append({
'xsi_type': 'SeedAdGroupIdSearchParameter',
'adGroupId': ad_group_id
})
keyword_search_volumes = []
more_pages = True
while more_pages:
page = targeting_idea_service.get(selector)
# Display results.
if 'entries' in page:
for result in page['entries']:
attributes = {}
for attribute in result['data']:
attributes[attribute['key']] = getattr(
attribute['value'], 'value', '0')
print(attributes)
keyword_search_volumes = keyword_search_volumes +
[[attributes['KEYWORD_TEXT'], attributes['SEARCH_VOLUME']]];
# print(('Keyword with "%s" text and average monthly search
volume '
# '"%s" was found with Products and Services
categories: %s.'
# % (attributes['KEYWORD_TEXT'],
# attributes['SEARCH_VOLUME'],
#
attributes['CATEGORY_PRODUCTS_AND_SERVICES'])))
else:
#please ignore this else
print('No related keywords were found.')
offset += PAGE_SIZE
selector['paging']['startIndex'] = str(offset)
more_pages = offset < int(page['totalNumEntries'])
print("done get SV");
return keyword_search_volumes;
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/18853113-e401-460b-a0e7-ea7737b8309e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.