Add_keyword_plan script ignores geotarget and also yields a bugged plan in which the location can't be changed.
Describe the bug: When I create a new keyword plan using the provided example code this does not match the geotarget given. Also trying to change this in the Google Keyword Planner UI does not work because the plan seems to be bugged. A plan created using the example script is set to global and google + search partners
Steps to Reproduce: The basic example code provided here will yield the behaviour
Expected behaviour: The keyword plan is created for the specified geo location (which in the code is the one for the US)
Client library version and API version: Client library version: Python 3.10.6 Google Ads API version:

@ccapsuna thanks for bringing this up. Could you be more specific as to which entity has this issue? Is it the KeywordPlanCampaign? When I run this example, then execute a search query for the same entity, I see that geoTargetConstants/2840 is included in the list of geo targets.
Is the issue there there's a difference between what the API shows and what the UI shows?
Hi Ben. I'm not sure what more I can tell you. I just downloaded the file I mentioned in my ticket, I plugged in my oauth 2 client details and refresh token, ran the code that's in there and I get a plan like the below. I cannot click to set the region or the language and I get this strange error that won't go away. I'm using v11 of the API.

@ccapsuna could you share your request/response logs from a request that generates a keyword plan like this, along with an updated screenshot like the above? I'm having trouble reproducing this myself...
@ccapsuna I'm going to close this out assuming you've found a resolution. If not please add more details here and I'll reopen it.
Hi @BenRKarl,
Please see below the only output I get when running the script. The behaviour has not changed. The only other thing I could mention is that I am running this from Ubuntu 20.04.5 running on WSL with the machine running Windows 11. I am not sure this makes any difference though. WSL ubuntu has been pretty solid.
Is there anyway I can get the client to output more verbose logs?

@ccapsuna yes, assuming you're using a google-ads.yaml file to configure the library, you can change the value here to DEBUG and get more detailed logs.
Before you post those here, please take a moment to remove and personally identifying information, such as developer token, OAuth tokens, etc.
@ccapsuna I'm going to close this out since I can't reproduce it. Please post more details request/response logs when you can, if you're continuing to encounter this problem.
Hi Ben. Apologies for my tardiness. Please see below the output with the DEBUG mode. Same behaviour occurs for me.
[2023-02-24 15:47:45 - DEBUG] Request
-------
Method: /google.ads.googleads.v11.services.KeywordPlanService/MutateKeywordPlans
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"x-goog-api-client": "gl-python/3.10.10 grpc/1.46.3 gax/2.8.2 gccl/18.0.0 pb/3.20.0+c",
"x-goog-request-params": "customer_id=xxxxxxxxxx"
}
Request: customer_id: "xxxxxxxxxx"
operations {
create {
forecast_period {
date_interval: NEXT_QUARTER
}
name: "Keyword plan for traffic estimate a9c1030e-b9d8-4080-a057-fea7aaa0da08"
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Fri, 24 Feb 2023 15:47:47 GMT",
"request-id": "WEPYfa5E55L5MZXhbrZSPQ"
}
Response: results {
resource_name: "customers/xxxxxxxxxx/keywordPlans/621532718"
}
[2023-02-24 15:47:45 - INFO] Request made: ClientCustomerId: xxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.KeywordPlanService/MutateKeywordPlans, RequestId: WEPYfa5E55L5MZXhbrZSPQ, IsFault: False, FaultMessage: None
Created keyword plan with resource name: customers/xxxxxxxxxx/keywordPlans/621532718
[2023-02-24 15:47:45 - DEBUG] Request
-------
Method: /google.ads.googleads.v11.services.KeywordPlanCampaignService/MutateKeywordPlanCampaigns
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"x-goog-api-client": "gl-python/3.10.10 grpc/1.46.3 gax/2.8.2 gccl/18.0.0 pb/3.20.0+c",
"x-goog-request-params": "customer_id=xxxxxxxxxx"
}
Request: customer_id: "xxxxxxxxxx"
operations {
create {
keyword_plan_network: GOOGLE_SEARCH
geo_targets {
geo_target_constant: "geoTargetConstants/2840"
}
keyword_plan: "customers/xxxxxxxxxx/keywordPlans/621532718"
name: "Keyword plan campaign 2c6fcd16-162e-480d-9a84-8d2b27cec51a"
language_constants: "languageConstants/1000"
cpc_bid_micros: 1000000
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Fri, 24 Feb 2023 15:47:47 GMT",
"request-id": "doWbhBZmA2Tqo6FOh6XMEg"
}
Response: results {
resource_name: "customers/xxxxxxxxxx/keywordPlanCampaigns/573910532"
}
[2023-02-24 15:47:45 - INFO] Request made: ClientCustomerId: xxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.KeywordPlanCampaignService/MutateKeywordPlanCampaigns, RequestId: doWbhBZmA2Tqo6FOh6XMEg, IsFault: False, FaultMessage: None
Created keyword plan campaign with resource name: customers/xxxxxxxxxx/keywordPlanCampaigns/573910532
[2023-02-24 15:47:46 - DEBUG] Request
-------
Method: /google.ads.googleads.v11.services.KeywordPlanAdGroupService/MutateKeywordPlanAdGroups
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"x-goog-api-client": "gl-python/3.10.10 grpc/1.46.3 gax/2.8.2 gccl/18.0.0 pb/3.20.0+c",
"x-goog-request-params": "customer_id=xxxxxxxxxx"
}
Request: customer_id: "xxxxxxxxxx"
operations {
create {
keyword_plan_campaign: "customers/xxxxxxxxxx/keywordPlanCampaigns/573910532"
name: "Keyword plan ad group eea3b750-9e07-489a-a1dc-f384c007cbf3"
cpc_bid_micros: 2500000
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Fri, 24 Feb 2023 15:47:47 GMT",
"request-id": "K9sTKsW5LcaQWuNUnR6z1g"
}
Response: results {
resource_name: "customers/xxxxxxxxxx/keywordPlanAdGroups/597337749"
}
[2023-02-24 15:47:46 - INFO] Request made: ClientCustomerId: xxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.KeywordPlanAdGroupService/MutateKeywordPlanAdGroups, RequestId: K9sTKsW5LcaQWuNUnR6z1g, IsFault: False, FaultMessage: None
Created keyword plan ad group with resource name: customers/xxxxxxxxxx/keywordPlanAdGroups/597337749
[2023-02-24 15:47:46 - DEBUG] Request
-------
Method: /google.ads.googleads.v11.services.KeywordPlanAdGroupKeywordService/MutateKeywordPlanAdGroupKeywords
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"x-goog-api-client": "gl-python/3.10.10 grpc/1.46.3 gax/2.8.2 gccl/18.0.0 pb/3.20.0+c",
"x-goog-request-params": "customer_id=xxxxxxxxxx"
}
Request: customer_id: "xxxxxxxxxx"
operations {
create {
match_type: BROAD
keyword_plan_ad_group: "customers/xxxxxxxxxx/keywordPlanAdGroups/597337749"
text: "mars cruise"
cpc_bid_micros: 2000000
}
}
operations {
create {
match_type: PHRASE
keyword_plan_ad_group: "customers/xxxxxxxxxx/keywordPlanAdGroups/597337749"
text: "cheap cruise"
cpc_bid_micros: 1500000
}
}
operations {
create {
match_type: EXACT
keyword_plan_ad_group: "customers/xxxxxxxxxx/keywordPlanAdGroups/597337749"
text: "jupiter cruise"
cpc_bid_micros: 1990000
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Fri, 24 Feb 2023 15:47:48 GMT",
"request-id": "zTxGUBe08IRS34GNACPBPA"
}
Response: results {
resource_name: "customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373505"
}
results {
resource_name: "customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373508"
}
results {
resource_name: "customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373511"
}
[2023-02-24 15:47:46 - INFO] Request made: ClientCustomerId: xxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.KeywordPlanAdGroupKeywordService/MutateKeywordPlanAdGroupKeywords, RequestId: zTxGUBe08IRS34GNACPBPA, IsFault: False, FaultMessage: None
Created keyword plan ad group keyword with resource name: customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373505
Created keyword plan ad group keyword with resource name: customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373508
Created keyword plan ad group keyword with resource name: customers/xxxxxxxxxx/keywordPlanAdGroupKeywords/1281117373511
[2023-02-24 15:47:46 - DEBUG] Request
-------
Method: /google.ads.googleads.v11.services.KeywordPlanCampaignKeywordService/MutateKeywordPlanCampaignKeywords
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"x-goog-api-client": "gl-python/3.10.10 grpc/1.46.3 gax/2.8.2 gccl/18.0.0 pb/3.20.0+c",
"x-goog-request-params": "customer_id=xxxxxxxxxx"
}
Request: customer_id: "xxxxxxxxxx"
operations {
create {
match_type: BROAD
keyword_plan_campaign: "customers/xxxxxxxxxx/keywordPlanCampaigns/573910532"
text: "moon walk"
negative: true
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Fri, 24 Feb 2023 15:47:48 GMT",
"request-id": "B_KwGsqm7veMlIA_Eh0ExA"
}
Response: results {
resource_name: "customers/xxxxxxxxxx/keywordPlanCampaignKeywords/496809546"
}
[2023-02-24 15:47:46 - INFO] Request made: ClientCustomerId: xxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.KeywordPlanCampaignKeywordService/MutateKeywordPlanCampaignKeywords, RequestId: B_KwGsqm7veMlIA_Eh0ExA, IsFault: False, FaultMessage: None
Created keyword plan campaign keyword with resource name: customers/xxxxxxxxxx/keywordPlanCampaignKeywords/496809546
Experienced the same issue here: location and language does not apply. And UI also shows an error message.
I'm using Windows 10.

Create Keyword Plan
keyword_plan_service = client.get_service("KeywordPlanService")
operation = client.get_type("KeywordPlanOperation")
keyword_plan = operation.create
keyword_plan.name = f"test {uuid.uuid4()}"
forecast_interval = (
client.enums.KeywordPlanForecastIntervalEnum.NEXT_MONTH
)
keyword_plan.forecast_period.date_interval = forecast_interval
response = keyword_plan_service.mutate_keyword_plans(
customer_id=CUSTOMER_ID, operations=[operation]
)
my_keyword_plan = response.results[0].resource_name
[2023-04-25 10:02:53 - DEBUG] Request
-------
Method: /google.ads.googleads.v13.services.KeywordPlanService/MutateKeywordPlans
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"login-customer-id": "aaaaaa",
"x-goog-api-client": "gl-python/3.9.16 grpc/1.54.0 gax/2.11.0 gccl/21.0.0 pb/4.22.3",
"x-goog-request-params": "customer_id=xxxxxxx"
}
Request: customer_id: "xxxxxxx"
operations {
create {
name: "test 27c7263e-8ec6-439c-9415-6cef7e77bd96"
forecast_period {
date_interval: NEXT_MONTH
}
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Tue, 25 Apr 2023 02:02:53 GMT",
"request-id": "cC4N6ut1dYiZvL-cV5xoSg"
}
Response: results {
resource_name: "customers/xxxxxxx/keywordPlans/668461145"
}
[2023-04-25 10:02:53 - INFO] Request made: ClientCustomerId: xxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v13.services.KeywordPlanService/MutateKeywordPlans, RequestId: cC4N6ut1dYiZvL-cV5xoSg, IsFault: False, FaultMessage: None
Create Keyword Plan Campaign
keyword_plan_campaign_service = client.get_service(
"KeywordPlanCampaignService"
)
operation = client.get_type("KeywordPlanCampaignOperation")
keyword_plan_campaign = operation.create
keyword_plan_campaign.name = f"Keyword plan campaign {uuid.uuid4()}"
keyword_plan_campaign.cpc_bid_micros = 4000000
keyword_plan_campaign.keyword_plan = my_keyword_plan
network = client.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH
keyword_plan_campaign.keyword_plan_network = network
geo_target = client.get_type("KeywordPlanGeoTarget")
geo_target.geo_target_constant = "geoTargetConstants/1014221"
keyword_plan_campaign.geo_targets.append(geo_target)
language = "languageConstants/1000"
keyword_plan_campaign.language_constants.append(language)
response = keyword_plan_campaign_service.mutate_keyword_plan_campaigns(
customer_id=CUSTOMER_ID, operations=[operation]
)
[2023-04-25 10:02:55 - DEBUG] Request
-------
Method: /google.ads.googleads.v13.services.KeywordPlanCampaignService/MutateKeywordPlanCampaigns
Host: googleads.googleapis.com
Headers: {
"developer-token": "REDACTED",
"login-customer-id": "aaaaaa",
"x-goog-api-client": "gl-python/3.9.16 grpc/1.54.0 gax/2.11.0 gccl/21.0.0 pb/4.22.3",
"x-goog-request-params": "customer_id=xxxxxx"
}
Request: customer_id: "xxxxxx"
operations {
create {
keyword_plan: "customers/xxxxxx/keywordPlans/668461145"
name: "Keyword plan campaign b680eeee-825c-4f02-8c1e-f4bd3c775a86"
language_constants: "languageConstants/1000"
keyword_plan_network: GOOGLE_SEARCH
cpc_bid_micros: 4000000
geo_targets {
geo_target_constant: "geoTargetConstants/1014221"
}
}
}
Response
-------
Headers: {
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"content-disposition": "attachment",
"date": "Tue, 25 Apr 2023 02:02:54 GMT",
"request-id": "Lq48cI2hqUK_-Yeu9uDtMw"
}
Response: results {
resource_name: "customers/xxxxxx/keywordPlanCampaigns/619378253"
}
[2023-04-25 10:02:55 - INFO] Request made: ClientCustomerId: xxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v13.services.KeywordPlanCampaignService/MutateKeywordPlanCampaigns, RequestId: Lq48cI2hqUK_-Yeu9uDtMw, IsFault: False, FaultMessage: None
@yusuzech @ccapsuna thanks for all the details. After doing some research internally I learned that this behavior is expected, and that creating keyword plans via the API is currently in a state of flux. I would recommend not trying to use the API and UI in conjunction with creating or updating keyword plans. If you have any further questions, please reach out to the support forum as they're better equipped to handle general Google Ads API questions like this.