This is my code.


            TargetingIdeaService targetingIdeaService = 
(TargetingIdeaService)user.GetService(AdWordsService.v201708.TargetingIdeaService);
            // Create selector.
            TargetingIdeaSelector selector = new TargetingIdeaSelector();
            selector.requestType = RequestType.STATS;
            selector.ideaType = IdeaType.KEYWORD;
            selector.requestedAttributeTypes = new AttributeType[] {
            AttributeType.KEYWORD_TEXT,
            AttributeType.SEARCH_VOLUME,
            AttributeType.CATEGORY_PRODUCTS_AND_SERVICES};
 
            // Create the search parameters.
            string keywordText = "tin tuc";
 
            // Create related to query search parameter.
            RelatedToQuerySearchParameter relatedToQuerySearchParameter =
                new RelatedToQuerySearchParameter();
            relatedToQuerySearchParameter.queries = new String[] { keywordText 
};
 
            // Add a language search parameter (optional).
            // The ID can be found in the documentation:
            //   
https://developers.google.com/adwords/api/docs/appendix/languagecodes
            LanguageSearchParameter languageParameter = new 
LanguageSearchParameter();
            Language english = new Language();
            english.id = 1000;
            languageParameter.languages = new Language[] { english };
 
            // Add network search parameter (optional).
            NetworkSetting networkSetting = new NetworkSetting();
            networkSetting.targetGoogleSearch = true;
            networkSetting.targetSearchNetwork = false;
            networkSetting.targetContentNetwork = false;
            networkSetting.targetPartnerSearchNetwork = false;
 
            NetworkSearchParameter networkSearchParameter = new 
NetworkSearchParameter();
            networkSearchParameter.networkSetting = networkSetting;
 
            // Set the search parameters.
            selector.searchParameters = new SearchParameter[] {
            relatedToQuerySearchParameter, languageParameter, 
networkSearchParameter
            };
 
            // Set selector paging (required for targeting idea service).
            Paging paging = Paging.Default;
            TargetingIdeaPage page = new TargetingIdeaPage();
            selector.paging = paging;
            try
            {
                int i = 0;
                do
                {
                    // Get related keywords.
                    page = targetingIdeaService.get(selector);
 
                    // Display related keywords.
                    if (page.entries != null && page.entries.Length > 0)
                    {
                        foreach (TargetingIdea targetingIdea in page.entries)
                        {
                            string keyword = null;
                            string categories = null;
                            long averageMonthlySearches = 0;
 
                            foreach (Type_AttributeMapEntry entry in 
targetingIdea.data)
                            {
                                if (entry.key == AttributeType.KEYWORD_TEXT)
                                {
                                    keyword = (entry.value as 
StringAttribute).value;
                                }
                                if (entry.key == 
AttributeType.CATEGORY_PRODUCTS_AND_SERVICES)
                                {
                                    IntegerSetAttribute categorySet = 
entry.value as IntegerSetAttribute;
                                    StringBuilder builder = new StringBuilder();
                                    if (categorySet.value != null)
                                    {
                                        foreach (int value in categorySet.value)
                                        {
                                            builder.AppendFormat("{0}, ", 
value);
                                        }
                                        categories = 
builder.ToString().Trim(new char[] { ',', ' ' });
                                    }
                                }
                                if (entry.key == AttributeType.SEARCH_VOLUME)
                                {
                                    averageMonthlySearches = (entry.value as 
LongAttribute).value;
                                }
                            }
                            //Console.WriteLine("Keyword with text '{0}', and 
average monthly search volume " +
                            //    "'{1}' was found with categories: {2}", 
keyword, averageMonthlySearches,
                            //    categories);
                            i++;
                        }
                    }
                    selector.paging.IncreaseOffset();
                } while (selector.paging.startIndex < page.totalNumEntries);
                //Console.WriteLine("Number of related keywords found: {0}", 
page.totalNumEntries);
            }
            catch (Exception e)
            {
                throw new System.ApplicationException("Failed to retrieve 
related keywords.", e);
            }


Result when use keyword planner


<https://lh3.googleusercontent.com/-pU2pygDN6Q4/Wdgqp72CdzI/AAAAAAAACL8/hSKUwIvMv8UzLu4dMjCgcjFzxxqt5Aj2gCL4CGAYYCw/s1600/screen1.jpg>


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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/8327a482-a623-4047-8656-b54f923fbd08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to