Getting less results for keyword than keywordplanner

20 views
Skip to first unread message

Bas Grave

unread,
Jan 16, 2025, 8:56:02 AMJan 16
to Google Ads API and AdWords API Forum
Dear,

I'm trying to build a small tool to do keyword research via my tool and automatically add it to google sheets, to make it easier to get keyword ideas. 

The problem i am facing is that for the same word 'Bedrijfsfilm', with same parameters like network ( google ), language constant Netherlands (1017) and geo target constants ( 2528  ).

I am getting only 2 results via my  tool, but with the ads keywordplanner i get 39 results, a lot more concepts. What can i do to retrieve the same ideas via the API?

         [response:Google\ApiCore\Page:private] => Google\Ads\GoogleAds\V16\Services\GenerateKeywordIdeaResponse Object
                (
                    [results] => Array
                        (
                            [0] => Array
                                (
                                    [text] => bedrijfsfilm
                                    [keywordIdeaMetrics] => Array
                                        (
                                            [avgMonthlySearches] => 320
                                            [monthlySearchVolumes] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JANUARY
                                                            [monthlySearches] => 390
                                                        )

                                                    [1] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => FEBRUARY
                                                            [monthlySearches] => 390
                                                        )

                                                    [2] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => MARCH
                                                            [monthlySearches] => 390
                                                        )

                                                    [3] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => APRIL
                                                            [monthlySearches] => 390
                                                        )

                                                    [4] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => MAY
                                                            [monthlySearches] => 390
                                                        )

                                                    [5] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JUNE
                                                            [monthlySearches] => 320
                                                        )

                                                    [6] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JULY
                                                            [monthlySearches] => 260
                                                        )

                                                    [7] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => AUGUST
                                                            [monthlySearches] => 170
                                                        )

                                                    [8] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => SEPTEMBER
                                                            [monthlySearches] => 210
                                                        )

                                                    [9] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => OCTOBER
                                                            [monthlySearches] => 260
                                                        )

                                                    [10] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => NOVEMBER
                                                            [monthlySearches] => 260
                                                        )

                                                    [11] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => DECEMBER
                                                            [monthlySearches] => 170
                                                        )

                                                )

                                            [competition] => MEDIUM
                                            [competitionIndex] => 51
                                            [lowTopOfPageBidMicros] => 3292875
                                            [highTopOfPageBidMicros] => 7336318
                                        )

                                    [keywordAnnotations] => Array
                                        (
                                        )

                                )

                            [1] => Array
                                (
                                    [text] => promotiefilm maken kosten
                                    [keywordIdeaMetrics] => Array
                                        (
                                            [avgMonthlySearches] => 10
                                            [monthlySearchVolumes] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JANUARY
                                                            [monthlySearches] => 10
                                                        )

                                                    [1] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => FEBRUARY
                                                            [monthlySearches] => 10
                                                        )

                                                    [2] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => MARCH
                                                            [monthlySearches] => 10
                                                        )

                                                    [3] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => APRIL
                                                            [monthlySearches] => 10
                                                        )

                                                    [4] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => MAY
                                                            [monthlySearches] => 10
                                                        )

                                                    [5] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JUNE
                                                            [monthlySearches] => 10
                                                        )

                                                    [6] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => JULY
                                                            [monthlySearches] => 10
                                                        )

                                                    [7] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => AUGUST
                                                            [monthlySearches] => 10
                                                        )

                                                    [8] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => SEPTEMBER
                                                            [monthlySearches] => 10
                                                        )

                                                    [9] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => OCTOBER
                                                            [monthlySearches] => 10
                                                        )

                                                    [10] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => NOVEMBER
                                                            [monthlySearches] => 10
                                                        )

                                                    [11] => Array
                                                        (
                                                            [year] => 2024
                                                            [month] => DECEMBER
                                                            [monthlySearches] => 10
                                                        )

                                                )

                                            [competition] => MEDIUM
                                            [competitionIndex] => 57
                                            [lowTopOfPageBidMicros] => 5082079
                                            [highTopOfPageBidMicros] => 8450479
                                        )

                                    [keywordAnnotations] => Array
                                        (
                                            [concepts] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [name] => Non-Brands
                                                            [conceptGroup] => Array
                                                                (
                                                                    [name] => 非品牌
                                                                    [type] => NON_BRAND
                                                                )

                                                        )

                                                )

                                        )

                                )

                        )

                    [totalSize] => 2
                )

    public function getKeywordIdeasByUrlOrWord($clientCustomerId, $input, $languageId, $locationIds = [], $pageUrl = null) {

        $keywordPlanIdeaServiceClient = $this->client->getKeywordPlanIdeaServiceClient();
   
        // Create an empty HistoricalMetricsOptions instance
        $historicalMetricsOptions = new HistoricalMetricsOptions();
   
        $requestParams = [
            'customer_id' => $clientCustomerId,
            'language' => $languageId,
            'keyword_plan_network' => KeywordPlanNetwork::GOOGLE_SEARCH,
            'geo_target_constants' => $locationIds,
            'historical_metrics_options' => $historicalMetricsOptions,
            'include_adult_keywords' => true,
            'keyword_annotation' => [
                KeywordPlanKeywordAnnotation::KEYWORD_CONCEPT,
            ],
            'page_size' => 10000
        ];
   
        if ($pageUrl && $input) {
            $requestParams['keyword_and_url_seed'] = new KeywordAndUrlSeed([
                'keywords' => [$input],
                'url' => $pageUrl
            ]);
        } elseif ($pageUrl) {
            $requestParams['url_seed'] = new UrlSeed(['url' => $pageUrl]);
        } elseif ($input) {
            $keywords = explode(',', $input);
            if( count($keywords) > 1 ) {
                $requestParams['keyword_seed'] = new KeywordSeed(['keywords' => $keywords]);
            } else {
                $requestParams['keyword_seed'] = new KeywordSeed(['keywords' => [$input]]);
            }
        }
   
        $request = new GenerateKeywordIdeasRequest($requestParams);
   
        try {

            $response = $keywordPlanIdeaServiceClient->generateKeywordIdeas($request);

        } catch (\Exception $e) {

            error_log('Error generating keyword ideas: ' . $e->getMessage());
            throw $e;

        }
   
        $keywordIdeas = [];

        error_log( print_r( $response, true ) );
   
        foreach ($response->iterateAllElements() as $result) {

            $metrics = $result->getKeywordIdeaMetrics();

            error_log( print_r( $result->getKeywordAnnotations(), true ) );

            $monthlySearchVolumes = [];
       
            if ($metrics && $metrics->getMonthlySearchVolumes()->count() > 0) {

                foreach ($metrics->getMonthlySearchVolumes() as $monthlyVolume) {

                    $year = $monthlyVolume->getYear();
                    $monthNumber = $monthlyVolume->getMonth();
                    $searches = $monthlyVolume->getMonthlySearches();
           
                    $monthName = DateTime::createFromFormat('!m', $monthNumber)->format('M');
           
                    $monthlySearchVolumes[] = [
                        'year' => $year,
                        'month' => $monthName,
                        'searches' => $searches,
                    ];

                }

            }

            $keywordIdeas[] = [
                'keyword' => $result->getText(),
                'avg_monthly_searches' => $metrics ? $metrics->getAvgMonthlySearches() : 'N/A',
                'competition' => $metrics ? KeywordPlanCompetitionLevel::name($metrics->getCompetition()) : 'N/A',
                'competition_index' => $metrics ? $metrics->getCompetitionIndex() : 'N/A',
                'low_top_of_page_bid' => $metrics && $metrics->hasLowTopOfPageBidMicros() ? $metrics->getLowTopOfPageBidMicros() / 1_000_000 : 'none',
                'high_top_of_page_bid' => $metrics && $metrics->hasHighTopOfPageBidMicros() ? $metrics->getHighTopOfPageBidMicros() / 1_000_000 : 'none',
                'monthly_search_volumes' => $monthlySearchVolumes,
            ];

        }        
   
        return $keywordIdeas;

    }

Google Ads API Forum Advisor

unread,
Jan 16, 2025, 1:49:36 PMJan 16
to adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

Based on the details provided, I understand that you are trying to use keywords with your own tool and are not getting the desired results as keyword planner from Google Ads API. To better assist, can you please share more details of the tool you are using and how is it being integrated with Google Ads API for searching keywords. Also kindly provide us with the complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled logging yet, I would request that you enable logging for the specific client library that you are using. You can refer to the guides in Java.NetPHPPythonRuby, or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGwG9:ref" (ADR-00284702)

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5


 

 

Reply all
Reply to author
Forward
0 new messages