Hi Guys,

I seem to be chewing up 4 or more API units per invocation of my below
script.  I'm confused because I'm only doing one get request to the
targetingIdeaService, which  according to the published rate sheet
should only cost me 1 API unit.

Here's an excerpt of the code:

$targetingIdeaService = $user->GetTargetingIdeaService('v200909');

                $lang = new LanguageTarget();
                $lang->languageCode = "en";
                $langs = array($lang);
                $languageTargetSearchParameter = new
                LanguageTargetSearchParameter($langs);

                $country = new CountryTarget();
                $country->countryCode = 'GB';
                $countries = array($country);
                $countryTargetSearchParameter = new
                CountryTargetSearchParameter($countries);

                // Create seed keyword.
                $input_keyword = "sleeping bags";
                $num_results_per_page = "1";
                $keyword = new Keyword();
                $keyword->text = $input_keyword;
                $keyword->matchType = 'EXACT';

                // Create selector.
                $selector = new TargetingIdeaSelector();
                $selector->requestType = 'STATS';
                $selector->ideaType = 'KEYWORD';
                $selector->requestedAttributeTypes =
array('KEYWORD','TARGETED_MONTHLY_SEARCHES');


                // Set selector paging (required for targeting idea service).
                $paging = new Paging();
                $paging->startIndex = 0;
                $paging->numberResults = $num_results_per_page;
                $selector->paging = $paging;

                // Create related to keyword search parameter.
                $relatedToKeywordSearchParameter = new
RelatedToKeywordSearchParameter();
                $relatedToKeywordSearchParameter->keywords = array($keyword);
                $selector->searchParameters = 
array($relatedToKeywordSearchParameter,
$countryTargetSearchParameter,$languageTargetSearchParameter);

                $page = $targetingIdeaService->get($selector);

                if (isset($page->entries)) {
                  foreach ($page->entries as $targetingIdea) {
                    $keyword = $targetingIdea->data[1]->value->value;
                    $lsv = $targetingIdea->data[0]->value->value[0]->count;
                    $month=$targetingIdea->data[0]->value->value[0]->month;
                    $year=$targetingIdea->data[0]->value->value[0]->year;
                    if (!is_numeric($lsv)) $lsv="NULL";
                    else $lsv=$lsv."|".$month."|".$year;
                  }
                } else $lsv="NULL";
            } catch (Exception $e) {}

Why is this operating costing me 4 or more API units ever time I run
this script?

The only thing that I can think is that I'm being charged for the
other methods that ther must be a cost associated with using the other
methods (LanguageTarget, CountryTarget etc.) that I'm using to narrow
the search results?

Also, is there a way to get accurate reporting on the API cost of each
request?

Please advise.

Many thanks!
Simon

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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

Reply via email to