I have a simple function to get the search volume for keywords, however in 
the last few days we noticed some strange behaviour, when the following 
keyword is sent the volume is correctly returned: 

words = ['test']

however when this keyword is sent the results are empty:

words = ['arutz']

even more when these words are sent together the results are empty as well:

words = ["test","arutz"]

(if I manually enter these in the keyword planner I do get search volumes 
for each word)

this is the function for getting the search volume:

def TestVolume(words):  
  PAGE_SIZE = 100


  # Initialize appropriate service.
  targeting_idea_service = client.GetService('TargetingIdeaService', version
='v201705')


  # Construct selector object and retrieve related keywords.
  offset = 0
  selector = {
    'searchParameters': [
        {
            'xsi_type': 'RelatedToQuerySearchParameter',
            'queries': words
        },
    ],
    'ideaType': 'KEYWORD',
    'requestType': 'STATS',
    'requestedAttributeTypes': ['KEYWORD_TEXT', 'SEARCH_VOLUME'],
    'paging': {
        'startIndex': str(offset),
        'numberResults': str(PAGE_SIZE)
    }
  }
  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 ('Keyword \'%s\'  average monthly search volume '
                 '\'%s\n'
                 % (attributes['KEYWORD_TEXT'],
                    attributes['SEARCH_VOLUME']))
          print attributes
          word = {}
          word[attributes['KEYWORD_TEXT']] = attributes['SEARCH_VOLUME']
        
      else:
        print 'No related keywords were found.'
      offset += PAGE_SIZE
      selector['paging']['startIndex'] = str(offset)
      more_pages = offset < int(page['totalNumEntries'])




-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/f2b74e32-99d3-4ae8-affc-f7461260a199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • strange results... Daphna Wegner
    • Re: strang... 'Peter Oliquino' via AdWords API Forum
      • Re: st... Daphna Wegner
        • Re... Daphna Wegner
          • ... 'Anash P. Oommen (AdWords API Team)' via AdWords API Forum
            • ... Daphna Wegner

Reply via email to