How do I get related keywords monthly search volume?

545 views
Skip to first unread message

abe-b...@pluralsight.com

unread,
Feb 15, 2017, 10:19:47 PM2/15/17
to AdWords API Forum
Hi there,

I'm trying to use the API with the Targeting Idea Service to get "targeted_monthly_searches" for various search terms: e.g., react.js, vue.js, angular.js. The trick is that I clearly get different results between, say, react.js and reactjs. So I'd prefer the aggregated related search term result be returned (i.e., the search traffic for "react.js" OR "reactjs"). I assume this is what occurs when match type is "broad," but I'm not sure how to specify different types of match when using the Targeting Idea Service (I see that the Traffic Estimator Service offers the ability to specify matchType as "BROAD", but this doesn't seem to be an option with the Targeting Idea Service.

Also, is there a way to put filtering in the query? I.e., when you're searching YouTube or Google you can be more specific by including OR, AND, and NOT parameters. But there doesn't seem to be any way to do that beyond just specifying matchType = BROAD. But does "broad" match type even function as desired (giving you, for example, an aggregate result for vuejs/vue.js/"vue js"/etc.?

############# Here's what works:

from googleads import adwords
import pandas as pd


adwords_client = adwords.AdWordsClient.LoadFromStorage()

PAGE_SIZE = 10

# Initialize appropriate service.
targeting_idea_service = adwords_client.GetService(
    'TargetingIdeaService', version='v201609')

# Construct selector object and retrieve related keywords.
offset = 0
stats_selector = {
    'searchParameters': [
        {
            'xsi_type': 'RelatedToQuerySearchParameter',
            'queries': ['react.js', 'reactjs', 'vuejs', 'vue.js']
        },
        {
        # Language setting (optional).
        # The ID can be found in the documentation:
            'xsi_type': 'LanguageSearchParameter',
            'languages': [{'id': '1000'}],
        },
        {
              # Network search parameter (optional)
              'xsi_type': 'NetworkSearchParameter',
              'networkSetting': {
                  'targetGoogleSearch': True,
                  'targetSearchNetwork': False,
                  'targetContentNetwork': False,
                  'targetPartnerSearchNetwork': False
              }
         }
    ],
    'ideaType': 'KEYWORD',
    'requestType': 'STATS',
    'requestedAttributeTypes': ['KEYWORD_TEXT', 'TARGETED_MONTHLY_SEARCHES'],
    'paging': {
        'startIndex': str(offset),
        'numberResults': str(PAGE_SIZE)
    }
}

stats_page = targeting_idea_service.get(stats_selector)


# Parse results to pandas dataframe

stats_pd = pd.DataFrame()

if 'entries' in stats_page:
    for stats_result in stats_page['entries']:
        stats_attributes = {}
        for stats_attribute in stats_result['data']:
            #print (stats_attribute)
            if stats_attribute['key'] == 'KEYWORD_TEXT':
                kt = stats_attribute['value']['value']
            else:
                for i, val in enumerate(stats_attribute['value'][1]):                
                    data = {'keyword': kt,
                            'year': val['year'],
                            'month': val['month'],
                            'count': val['count']}
                    data = pd.DataFrame(data, index = [i])                
                    stats_pd = stats_pd.append(data, ignore_index=True)


print(stats_pd)






########  And this doesn't (but would be appealing):

from googleads import adwords
import pandas as pd


adwords_client = adwords.AdWordsClient.LoadFromStorage()

PAGE_SIZE = 10

# Initialize appropriate service.
targeting_idea_service = adwords_client.GetService(
    'TargetingIdeaService', version='v201609')

# Construct selector object and retrieve related keywords.
offset = 0
stats_selector = {
    'searchParameters': [
        {
            'xsi_type': 'RelatedToQuerySearchParameter',
            'queries':  [
                            {'term': 'react js', 'matchType': 'BROAD'},
                            {'term': 'reactjs', 'matchType': 'PHRASE'},
                            {'term': 'react.js', 'matchType': 'EXACT'}
                        ]
        },
        {
        # Language setting (optional).
        # The ID can be found in the documentation:
            'xsi_type': 'LanguageSearchParameter',
            'languages': [{'id': '1000'}],
        },
        {
              # Network search parameter (optional)
              'xsi_type': 'NetworkSearchParameter',
              'networkSetting': {
                  'targetGoogleSearch': True,
                  'targetSearchNetwork': False,
                  'targetContentNetwork': False,
                  'targetPartnerSearchNetwork': False
              }
         }
    ],
    'ideaType': 'KEYWORD',
    'requestType': 'STATS',
    'requestedAttributeTypes': ['KEYWORD_TEXT', 'TARGETED_MONTHLY_SEARCHES'],
    'paging': {
        'startIndex': str(offset),
        'numberResults': str(PAGE_SIZE)
    }
}

stats_page = targeting_idea_service.get(stats_selector)


# Parse results to pandas dataframe

stats_pd = pd.DataFrame()

if 'entries' in stats_page:
    for stats_result in stats_page['entries']:
        stats_attributes = {}
        for stats_attribute in stats_result['data']:
            #print (stats_attribute)
            if stats_attribute['key'] == 'KEYWORD_TEXT':
                kt = stats_attribute['value']['value']
            else:
                for i, val in enumerate(stats_attribute['value'][1]):                
                    data = {'keyword': kt,
                            'year': val['year'],
                            'month': val['month'],
                            'count': val['count']}
                    data = pd.DataFrame(data, index = [i])                
                    stats_pd = stats_pd.append(data, ignore_index=True)


print(stats_pd)






######### Or this would be a nice solution:


from googleads import adwords
import pandas as pd


adwords_client = adwords.AdWordsClient.LoadFromStorage()

PAGE_SIZE = 10

# Initialize appropriate service.
targeting_idea_service = adwords_client.GetService(
    'TargetingIdeaService', version='v201609')

# Construct selector object and retrieve related keywords.
offset = 0
stats_selector = {
    'searchParameters': [
        {
            'xsi_type': 'RelatedToQuerySearchParameter',
            'queries':  [
                            {'term': 'vue js|vue.js|vuejs', 'as': 'vue.js'},
                            {'term': 'react js|react.js|reactjs', 'as': 'react.js'},
                            {'term': 'angular js|angular.js|angularjs', 'as': 'angular.js'}
                        ]
        },
        {
        # Language setting (optional).
        # The ID can be found in the documentation:
            'xsi_type': 'LanguageSearchParameter',
            'languages': [{'id': '1000'}],
        },
        {
              # Network search parameter (optional)
              'xsi_type': 'NetworkSearchParameter',
              'networkSetting': {
                  'targetGoogleSearch': True,
                  'targetSearchNetwork': False,
                  'targetContentNetwork': False,
                  'targetPartnerSearchNetwork': False
              }
         }
    ],
    'ideaType': 'KEYWORD',
    'requestType': 'STATS',
    'requestedAttributeTypes': ['KEYWORD_TEXT', 'TARGETED_MONTHLY_SEARCHES'],
    'paging': {
        'startIndex': str(offset),
        'numberResults': str(PAGE_SIZE)
    }
}

stats_page = targeting_idea_service.get(stats_selector)


# Parse results to pandas dataframe

stats_pd = pd.DataFrame()

if 'entries' in stats_page:
    for stats_result in stats_page['entries']:
        stats_attributes = {}
        for stats_attribute in stats_result['data']:
            #print (stats_attribute)
            if stats_attribute['key'] == 'KEYWORD_TEXT':
                kt = stats_attribute['value']['value']
            else:
                for i, val in enumerate(stats_attribute['value'][1]):                
                    data = {'keyword': kt,
                            'year': val['year'],
                            'month': val['month'],
                            'count': val['count']}
                    data = pd.DataFrame(data, index = [i])                
                    stats_pd = stats_pd.append(data, ignore_index=True)


print(stats_pd)

Peter Oliquino

unread,
Feb 16, 2017, 1:57:46 AM2/16/17
to AdWords API Forum
Hi Abe,

There is currently no way that I am aware of that you can set the matchType of a keyword as a filter in the TargetingIdeaService or in the AdWords UI (via the Keyword Planner tool). Keyword results can be retrieved or filtered based on their RequestTypes, being IDEAS (to retrieve similar keyword ideas for your current keywords) or STATS (for retrieving historical keyword statistics). You may also refer to the TargetingIdeaSelector for more information on how to define specific criteria for your requests. 

Additionally, could you confirm if you have tried your request both in the AdWords UI and the AdWords API and if you have gotten different results? If you experience any discrepancies, kindly send us the screenshot in the AdWords UI and the sample SOAP request and response so we can further investigate. You may reply using Reply privately to author.

As for the parameters that you mentioned, you may refer here for the list of available search parameters in the TargetingIdeaService. The NetworkSearchParameter should allow you to filter through the networks you wish to retrieve your results by specifying a target network in your NetworkSetting.

Best regards,
Peter
AdWords API Team

Matic Jurglic

unread,
Mar 15, 2019, 9:51:42 AM3/15/19
to AdWords API and Google Ads API Forum
Hey Peter,

I'm having an issue where two seemingly similar keyword queries return the same search volume using TargetingIdeaService. The keywords are "erpsim" and "serpsim" - I receive identical search volume and CPC for both of them (880 and 4.91, respectively). This is really misleading because the keywords are not related. I think the API is doing a broad match. Is there an option to specify exact match mode for keywords using TargetingIdeaService
Reply all
Reply to author
Forward
0 new messages