What "operations" do I use to get keyword search volume from the googleads api? (TargetingIdeaService)

Viewed 320

I am trying to get a search volume metric from the Google Ads API. I am running into trouble when I using the "SearchVolumeSearchParameter" argument. This argument requires an "operation" field and the documentation does not do a great job on explaining what these operations can be. Preferably, I would like the script to return a list of keywords and their respective search volumes for the previous month.

adwords_client = adwords.AdWordsClient.LoadFromStorage()
targeting_idea_service = adwords_client.GetService(
      'TargetingIdeaService', version='v201809') 

selector = {
    'ideaType': 'KEYWORD',
    'requestType': 'STATS'
}

selector['requestedAttributeTypes'] = [
    'KEYWORD_TEXT', 
    'SEARCH_VOLUME', 
    # 'TARGETED_MONTHLY_SEARCHES',
]
offset = 0
PAGE_SIZE = 500
selector['paging'] = {
    'startIndex': str(offset),
    'numberResults': str(PAGE_SIZE)
}
selector['searchParameters'] = [{
        'xsi_type': 'SearchVolumeSearchParameter',
         'operation': []
                }]
page = targeting_idea_service.get(selector)
1 Answers

You use maximum, minimum like so:

  selector['searchParameters'] = [
      {
      'xsi_type': 'RelatedToQuerySearchParameter',
      'queries': search_keywords
      },
      {
      'xsi_type': 'LocationSearchParameter',
      'locations': [
          {'id': location_id}  
        ]
      },
      {
      'xsi_type': 'SearchVolumeSearchParameter',
       'operation': [
          {'minimum': 100}
       ]
      }
  ]
Related