Hi,

You need to ensure that the CountryTargetSearchParameter and
LanguageTargetSearchParameter are added to $selector-
>searchParameters.

Best,
- Eric Koleda, AdWords API Team

On Nov 4, 1:14 pm, APIWorker <[email protected]> wrote:
> Hi all,
>
> I'm new to this forum and hope someone can help me because I've
> searched for a solution here without any result.
>
> I'm using the TargetingIdeaService of the API in version v201008. When
> I send a request for an exact keyword stat using geotargeting (german
> in germany) the returned value from the API is the number of global
> monthly searches - even if I request the average targeted monthly
> searches.
>
> Short: I need the average targeted monthly searches value for a
> keyword in germany and in german language.
>
> You can find the code of my PHP function beneath - maybe it's only a
> hidden coding error, but I can't find it.
>
> Best regards!
>
> function get_search_volumina ($keywordquery){
>
>         GLOBAL $targetingIdeaService;
>
>         // Create seed keyword.
>         $keyword = new Keyword();
>         $keyword->text = $keywordquery;
>         $keyword->matchType = 'EXACT';
>
>         // Creare language service.
>         $languageService= new LanguageTarget();
>         $languageService->languageCode='de';
>         $languageService->TargetType='de';
>
>         // Create country service.
>         $countryService= new CountryTargetSearchParameter();
>         $countryService->countryTargets='DE';
>
>         // Create selector.
>         $selector = new TargetingIdeaSelector();
>         $selector->requestType = 'STATS';
>         $selector->ideaType = 'KEYWORD';
>         $selector->requestedAttributeTypes = array('KEYWORD',
> AVERAGE_TARGETED_MONTHLY_SEARCHES');
>
>         // Create and set selector paging (required for targeting idea
> service).
>         $paging = new Paging();
>         $paging->startIndex = 0;
>         $paging->numberResults = 10;
>         $selector->paging = $paging;
>
>         // Create related to keyword search parameter.
>         $relatedToKeywordSearchParameter = new
> RelatedToKeywordSearchParameter(array($keyword), $languageService,
> $countryService);
>
>         // Create keyword match type search parameter to ensure unique
> results.
>         $keywordMatchTypeSearchParameter = new
> KeywordMatchTypeSearchParameter();
>         $keywordMatchTypeSearchParameter->keywordMatchTypes = array('EXACT');
>
>         // Set the selector.
>         $selector->searchParameters = array($relatedToKeywordSearchParameter,
> $keywordMatchTypeSearchParameter);
>
>         // Get related keywords.
>         $page = $targetingIdeaService->get($selector);
>
>         // Display related keywords.
>         if (isset($page->entries)) {
>                 foreach ($page->entries as $targetingIdea) {
>                         $data = MapUtils::GetMap($targetingIdea->data);
>                         $keyword = $data['KEYWORD']->value;
>
>                         $averageMonthlySearches =
>                           
> isset($data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value)
>                           ? $data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value 
> : 0;
>
>                         $return = $averageMonthlySearches;
>                 }
>
>         } else {
>                 $return = "No related keywords were found.";
>         }
>
>         return $return;
>
>
>
>
>
>
>
> } // End of get_search_volumina.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to