Everything is working fine but when I try to set the NetworkSearchParameter to only use Google Search results it doesn't seem to return the correct values. It returns the number of searches from Google + Search Networks.
My code is: $networkSearchParameter = new NetworkSearchParameter(); $networkSearchParameter->networkSetting = 'targetGoogleSearch'; $selector->searchParameters[] = $networkSearchParameter; Also tried: $networkSearchParameter = new NetworkSearchParameter(); $networkSetting = new NetworkSetting(); $networkSetting->targetGoogleSearch = true; $networkSearchParameter->networkSetting = $networkSetting; $selector->searchParameters[] = $networkSearchParameter; And: $networkSetting = new NetworkSetting(); $networkSetting->targetGoogleSearch = true; $selector->networkSetting = $networkSetting Is there something I am missing here? The documentation/examples on this are unclear and this is for the TargetingIdeaService. Thanks. = = = The full code is below in case that is needed: <?php // Include the initialization file require_once dirname( __FILE__ ) . '/../../' . 'adwords-init.php'; require_once UTIL_PATH . '/MapUtils.php'; function getSearches($keywords) { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Get the service, which loads the required classes. $targetingIdeaService = $user->GetService('TargetingIdeaService', ADWORDS_VERSION); // Create selector. $selector = new TargetingIdeaSelector(); $selector->requestType = 'STATS'; $selector->ideaType = 'KEYWORD'; $selector->requestedAttributeTypes = array('KEYWORD_TEXT', 'SEARCH_VOLUME', 'AVERAGE_CPC'); // Create language search parameter (optional). // The ID can be found in the documentation: // https://developers.google.com/adwords/api/docs/appendix/languagecodes // Note: As of v201302, only a single language parameter is allowed. $languageParameter = new LanguageSearchParameter(); $english = new Language(); $english->id = 1000; $languageParameter->languages = array($english); // Create related to query search parameter. $relatedToQuerySearchParameter = new RelatedToQuerySearchParameter(); $relatedToQuerySearchParameter->queries = $keywords; $selector->searchParameters[] = $relatedToQuerySearchParameter; $selector->searchParameters[] = $languageParameter; // Set selector paging (required by this service). $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE); do { // Make the get request. $page = $targetingIdeaService->get($selector); // Display results. if (isset($page->entries)) : $results_array = array(); foreach ($page->entries as $targetingIdea) : $data = MapUtils::GetMap($targetingIdea->data); $keyword = $data['KEYWORD_TEXT']->value; $search_volume = isset($data['SEARCH_VOLUME']->value) ? $data['SEARCH_VOLUME']->value : 0; $average_cpc = isset($data['AVERAGE_CPC']->value->microAmount) ? $data['AVERAGE_CPC']->value->microAmount : 0; $average_cpc = floatval($average_cpc) / 1000000; $results_array[] = array( $keyword, $search_volume, $average_cpc ); endforeach; else : print "No keywords ideas were found.\n"; return false; endif; // Advance the paging index. $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE; } while ($page->totalNumEntries > $selector->paging->startIndex); return json_encode( $results_array ); } // Don't run the example if the file is being included. if (__FILE__ != realpath($_SERVER['PHP_SELF'])) { return; } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. //$user->LogAll(); // Create seed keyword. $keywords = array( 'Testing' , 'Web development' ); $results_array = GetSearchVolume($user, $keywords); print_r ( $results_array ); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); } -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/3b85d1fb-487b-4c9c-bb41-d460f75ce846%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.