Hello, I'm creating script using Google Adwords PHP api version 'v201702' 
to find most searcing keywords for my company business. 
Here is my test code, I was getting unrealistic result for Request Type : 
STATS. 

/**
 * @param AdWordsServices $adWordsServices
 * @param AdWordsSession $session
 */
public static function runExample(AdWordsServices $adWordsServices,
    AdWordsSession $session)
{
    $targetingIdeaService =
        $adWordsServices->get($session, TargetingIdeaService::class);

    // Create selector.
    $selector = new TargetingIdeaSelector();
    $selector->setRequestType(RequestType::STATS);
    $selector->setIdeaType(IdeaType::KEYWORD);
    $selector->setRequestedAttributeTypes([
        AttributeType::KEYWORD_TEXT,
        AttributeType::SEARCH_VOLUME,
        AttributeType::CATEGORY_PRODUCTS_AND_SERVICES
    ]);

    $searchParameters = [];
    // Create seed keyword.
    $keyword = 'aasdasdasdasdasdasdasdasdasd';
    // Create related to query search parameter.
    $relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
    $relatedToQuerySearchParameter->setQueries([$keyword]);
    $searchParameters[] = $relatedToQuerySearchParameter;

    // Create language search parameter (optional).
    // The ID can be found in the documentation:
    // https://developers.google.com/adwords/api/docs/appendix/languagecodes
    $languageParameter = new LanguageSearchParameter();
    $english = new Language();
    $english->setId(1000);
    $languageParameter->setLanguages([$english]);
    $searchParameters[] = $languageParameter;

    // Create network search parameter (optional).
    $networkSetting = new NetworkSetting();
    $networkSetting->setTargetGoogleSearch(true);
    $networkSetting->setTargetSearchNetwork(false);
    $networkSetting->setTargetContentNetwork(false);
    $networkSetting->setTargetPartnerSearchNetwork(false);

    $networkSearchParameter = new NetworkSearchParameter();
    $networkSearchParameter->setNetworkSetting($networkSetting);
    $searchParameters[] = $networkSearchParameter;

    $selector->setSearchParameters($searchParameters);
    $selector->setPaging(new Paging(0, 50));

    $totalNumEntries = 0;
    do {
        // Retrieve targeting ideas one page at a time, continuing to request
        // pages until all of them have been retrieved.
        $page = $targetingIdeaService->get($selector);

        // Print out some information for each targeting idea.
        if ($page->getEntries() !== null) {
            $totalNumEntries = $page->getTotalNumEntries();
            foreach ($page->getEntries() as $targetingIdea) {
                $data = 
MapEntries::toAssociativeArray($targetingIdea->getData());
                $keyword = $data[AttributeType::KEYWORD_TEXT]->getValue();
                $searchVolume =
                    ($data[AttributeType::SEARCH_VOLUME]->getValue() !== null)
                        ? $data[AttributeType::SEARCH_VOLUME]->getValue() : 0;
                $categoryIds =
                    
($data[AttributeType::CATEGORY_PRODUCTS_AND_SERVICES]->getValue()
                        === null)
                        ? $categoryIds = '' : implode(', ', $data[
                    AttributeType::CATEGORY_PRODUCTS_AND_SERVICES]->getValue());
                printf(
                    "Keyword idea with text '%s', category IDs (%d) and average 
"
                    . "monthly search volume %d was found.\n",
                    $keyword,
                    $categoryIds,
                    $searchVolume
                );
            }
        }

        $selector->getPaging()->setStartIndex(
            $selector->getPaging()->getStartIndex() + 50);
    } while ($selector->getPaging()->getStartIndex() < $totalNumEntries);

    printf("Number of results found: %d\n", $totalNumEntries);
}


And the response that I get is ridiculous:

<https://lh3.googleusercontent.com/-I1qwx5CtyQI/WSsSZC1uGZI/AAAAAAAAADA/4YqKjcYBRcgFSoES1a4C6sOuuIXQbia4QCLcB/s1600/Screen%2BShot%2B2017-05-28%2Bat%2B8.09.16%2BPM.png>

The same "huge" results I was getting for my keywords, and it not matching 
Keyword Planner ~200 monthly search .

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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
--- 
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 [email protected].
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/310da973-19f7-46e5-b8e2-c9b8fb53111d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to