Data mismatch between Google UI (Keyword planner) and API

139 views
Skip to first unread message

kakaka11

unread,
Jan 3, 2024, 7:26:22 PM1/3/24
to Google Ads API and AdWords API Forum
The values ​​called through the Keyword Planner provided by Google and the API are different. There is a big difference in the values. Is this really the case?

I used the sample code in the link below.

def main(
    client
, customer_id, location_ids, language_id, keyword_texts, page_url
):
    keyword_plan_idea_service
= client.get_service("KeywordPlanIdeaService")
    keyword_competition_level_enum
= (
        client
.enums.KeywordPlanCompetitionLevelEnum
   
)
    keyword_plan_network
= (
        client
.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH_AND_PARTNERS
   
)
    location_rns
= map_locations_ids_to_resource_names(client, location_ids)
    language_rn
= client.get_service("GoogleAdsService").language_constant_path(
        language_id
   
)

   
# Either keywords or a page_url are required to generate keyword ideas
   
# so this raises an error if neither are provided.
   
if not (keyword_texts or page_url):
       
raise ValueError(
           
"At least one of keywords or page URL is required, "
           
"but neither was specified."
       
)

   
# Only one of the fields "url_seed", "keyword_seed", or
   
# "keyword_and_url_seed" can be set on the request, depending on whether
   
# keywords, a page_url or both were passed to this function.
    request
= client.get_type("GenerateKeywordIdeasRequest")
    request
.customer_id = customer_id
    request
.language = language_rn
    request
.geo_target_constants = location_rns
    request
.include_adult_keywords = False
    request
.keyword_plan_network = keyword_plan_network

   
# To generate keyword ideas with only a page_url and no keywords we need
   
# to initialize a UrlSeed object with the page_url as the "url" field.
   
if not keyword_texts and page_url:
        request
.url_seed.url = page_url

   
# To generate keyword ideas with only a list of keywords and no page_url
   
# we need to initialize a KeywordSeed object and set the "keywords" field
   
# to be a list of StringValue objects.
   
if keyword_texts and not page_url:
        request
.keyword_seed.keywords.extend(keyword_texts)

   
# To generate keyword ideas using both a list of keywords and a page_url we
   
# need to initialize a KeywordAndUrlSeed object, setting both the "url" and
   
# "keywords" fields.
   
if keyword_texts and page_url:
        request
.keyword_and_url_seed.url = page_url
        request
.keyword_and_url_seed.keywords.extend(keyword_texts)

    keyword_ideas
= keyword_plan_idea_service.generate_keyword_ideas(
        request
=request
   
)

   
for idea in keyword_ideas:
        competition_value
= idea.keyword_idea_metrics.competition.name
       
print(
            f
'Keyword idea text "{idea.text}" has '
            f
'"{idea.keyword_idea_metrics.avg_monthly_searches}" '
            f
'average monthly searches and "{competition_value}" '
           
"competition.\n"
       
)

Google Ads API Forum Advisor

unread,
Jan 4, 2024, 2:49:02 AM1/4/24
to xlfl...@gmail.com, adwor...@googlegroups.com
Hi,

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

After reviewing your concern, I understand that you are observing the data discrepancy in the values of Keyword Planner between the Google Ads UI and the API.

In order to assist you further, kindly provide us with the complete API logs (request and response with request-id and request header) generated at your end along with the corresponding uncropped UI screenshot (from Google Ads account).

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides 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.!5004Q02r5Hiq:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages