TargetingIdeaPage Entries always is null

72 views
Skip to first unread message

pham tri

unread,
Oct 9, 2017, 12:24:44 AM10/9/17
to AdWords API Forum
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);

            }





This is result in Keyword Planner


Peter Oliquino

unread,
Oct 9, 2017, 1:46:41 AM10/9/17
to AdWords API Forum
Hi,

In order to further investigate the issue, could you send to me the complete SOAP request and response generated when you used the TargetingIdeaService? You may reply using the Reply privately to author option.

Thanks and regards,
Peter
AdWords API Team

Peter Oliquino

unread,
Oct 16, 2017, 4:48:49 AM10/16/17
to AdWords API Forum
Hi,

Could you confirm if you still require assistance? If yes, you may send to me privately the information I previously requested.

pham tri

unread,
Oct 23, 2017, 10:52:18 PM10/23/17
to AdWords API Forum
I do not know how to get SOAP in c#. 

Vào 12:46:41 UTC+7 Thứ Hai, ngày 09 tháng 10 năm 2017, Peter Oliquino đã viết:

pham tri

unread,
Oct 23, 2017, 10:55:59 PM10/23/17
to AdWords API Forum
Sr. I do not know you repply, i do not see notice of your question via email...

Vào 15:48:49 UTC+7 Thứ Hai, ngày 16 tháng 10 năm 2017, Peter Oliquino đã viết:
Chào,

Bạn có thể xác nhận nếu bạn vẫn cần hỗ trợ? Nếu có, bạn có thể gửi cho tôi tư nhân thông tin mà tôi đã yêu cầu trước đó.

Cảm ơn và kính chào,
Peter
Nhóm AdWords API

Peter Oliquino

unread,
Oct 24, 2017, 2:11:00 AM10/24/17
to AdWords API Forum
Hi,

You may be able to enable SOAP logging by referring to this guide. Once enabled, you can try your request once more and send to me privately (using the Reply privately to author option) the generated SOAP request and response so our team could take a closer look at the issue.

pham tri

unread,
Oct 24, 2017, 11:48:47 PM10/24/17
to AdWords API Forum
Thanks .This is my log.

Vào 13:11:00 UTC+7 Thứ Ba, ngày 24 tháng 10 năm 2017, Peter Oliquino đã viết:
summary_logs.log

pham tri

unread,
Oct 24, 2017, 11:58:10 PM10/24/17
to AdWords API Forum


Vào 10:48:47 UTC+7 Thứ Tư, ngày 25 tháng 10 năm 2017, pham tri đã viết:
System.Net.trace.log
Reply all
Reply to author
Forward
0 new messages