Posts tagged with keyword

I have been working with the Google Ads API to generate keyword ideas using the Keyword Planner. The script works perfectly fine on macOS, and I've tested it on multiple Mac machines without any issues. However, when I try to run the same script on an Ubuntu machine, it fails with the following error:

root@545d9b292810:/app# python3 generate_keyword_ideas.py --customer_id 473727 Traceback (most recent call last):   File "/usr/local/lib/python3.8/dist-packages/google/ads/googleads/client.py", line 203, in _get_api_services_by_version     version_module = import_module(f"google.ads.googleads.{version}")   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import   File "<frozen importlib._bootstrap>", line 991, in _find_and_load   File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'google.ads.googleads.v17' During handling of the above exception, another exception occurred: Traceback (most recent call last):   File "generate_keyword_ideas.py", line 176, in <module>     main(   File "generate_keyword_ideas.py", line 38, in main     keyword_plan_idea_service = client.get_service("KeywordPlanIdeaService")   File "/usr/local/lib/python3.8/dist-packages/google/ads/googleads/client.py", line 356, in get_service     api_module = self._get_api_services_by_version(version)   File "/usr/local/lib/python3.8/dist-packages/google/ads/googleads/client.py", line 205, in _get_api_services_by_version     raise ValueError( ValueError: Specified Google Ads API version "v17" does not exist. Valid API versions are: "v11", "v10", "v9" 

What I've Tried: I have confirmed that the Google Ads API library version 17.0.0 is installed on both macOS and Ubuntu. The Python version on Ubuntu is 3.8, and I ensured that all dependencies are correctly installed. I’ve tried reinstalling the google-ads package and even setting up a fresh virtual environment. The script works flawlessly on macOS, so the issue seems to be specific to Ubuntu.

The script should run on Ubuntu just as it does on macOS without throwing the "Specified Google Ads API version 'v17' does not exist" error.

Specifications: Python version: 3.8 on Ubuntu Google Ads API library version: 17.0.0 OS: Ubuntu 20.04

I am creating a web platform on which we would like to let our users (many thousands) use the Google Keyword Planer tool via API to look up word statisks and also suggest new words, if possible.

From what I can read in Google's API docs you have to have an account with Google to use the KW planer. Isn't it possible to somehow use KW planer via API without have each user creating a Google Ads account? Paid or not paid.

Our new online service can of course have a hidden central Google account as long as we can provide volume searches as explained above. But it looks like Google slows down search speed if you do too many searches, and we can't have that.

I am happy for any suggestion on how to get access to the KW planer via API for large volume use. Semrush does something like this. They surely must get their data from Google.

Thanks for helping!

I may be doing it the wrong way but I want, at first, to extract keyword traffic information like I did with TrafficEstimationService in the (now deprecated) AdWords API. My code looks like this (with some edits here and there):

# [... some initialization (clients, service accounts, etc.) bits here] # fetch an instance of the Google Ads client gc = GoogleAdsClient.load_from_storage(gads_credentials_file, version="v10") # fetch an instance of the Google Ads service gs = gc.get_service("GoogleAdsService") # fetch an instance of the Geo Target Constant service gtcs = gc.get_service("GeoTargetConstantService").geo_target_constant_path # fetch an instance of the keyword plan idea service ks = gc.get_service("KeywordPlanIdeaService") # build the initial search request rq = gc.get_type("GenerateKeywordIdeasRequest") rq.customer_id = gads_account_id.replace("-", '') rq.geo_target_constants = [gtcs(get_location_id(gads_country))] rq.keyword_plan_network = (gc.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH_AND_PARTNERS) rq.language = gs.language_constant_path(get_language_id(gads_language)) rq.keyword_annotation = gc.enums.KeywordPlanKeywordAnnotationEnum if len(gads_keywords) > 0:     rq.keyword_seed.keywords.extend(gads_keywords) # generate keyword ideas keyword_ideas = ks.generate_keyword_ideas(request=rq) rows = [] for idea in keyword_ideas:     rows.append({         "date": r,         "text": idea.text,         "competition_value": idea.keyword_idea_metrics.competition.name,         "avg_monthly_searches": idea.keyword_idea_metrics.avg_monthly_searches     }) 

So far, so good. I can specify location and language and (of course) they keywords to look for. At the end of this request, I have something like this (just printing the first list item):

{'date': '2022-08-09', 'text': 'zapatos', 'competition_value': 'MEDIUM', 'avg_monthly_searches': 301000} 

The problem I have is I have been requested to ensure the match type is EXACT but looking at both the documentation and the source code for KeywordPlanIdeaService there is no trace of this parameter. That's why I assume I'm doing it wrong (or maybe I'm lacking something here). In any case, I'm a bit lost.

Can you tell me how can I specify this (if it can be done) or an alternate way to accomplish this?

I'm trying to use google_ads_api to generate keywords idea. I found an error when I execute generateKeywordsIdeas.php file.

PS C:\xampp\htdocs\google_ads_api> php GenerateKeywordIdeas.php PHP Fatal error: Uncaught Error: Class 'Google\Ads\GoogleAds\Examples\Utils\ArgumentParser' not found in C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php:67 Stack trace:

#0 C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php(212): Google\Ads\GoogleAds\Examples\Planning\GenerateKeywordIdeas::main()
#1 {main} thrown in C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php on line 67

Fatal error: Uncaught Error: Class 'Google\Ads\GoogleAds\Examples\Utils\ArgumentParser' not found in C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php:67 Stack trace:
#0 C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php(212): Google\Ads\GoogleAds\Examples\Planning\GenerateKeywordIdeas::main()
#1 {main} thrown in C:\xampp\htdocs\google_ads_api\GenerateKeywordIdeas.php on line 67

Here is file structure of my project

Why this error happens..? can anybody explain..?