Skip to content

Keyword Research with Python (Google Ads API + Google Suggestions + Gemini 1.5 Flash)

Notifications You must be signed in to change notification settings

seoffensive/Keyword_Research

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

With the Keyword Research script, you can discover all keywords related to the main keywords in groups. This includes latent semantic indexing and long tail keywords. In this way, you can get all related keywords in bulk without doing manual keyword research for hundreds of keywords.

This script obtains individual keyword variations for each main keyword from the Google Ads API, Google autocomplete suggestions, and the Gemini 1.5 Flash model. Then, all the keywords are clustered according to SERP similarity with the help of a completely free tool. Finally, all keywords are presented grouped on a single page.

YouTube Link 👉 https://www.youtube.com/watch?v=Ka60_tq0FRM

How to install?

  1. Create a new project in Google Cloud. Then go to APIs & services > Credentials, click on Create Credentials and create an Oauth client ID.

image

  1. When you are generating your OAuth client ID, select in the application type Desktop App and click on Create.

image

  1. After creating the OAuth ID, you should be able to see this

image

  1. After creating the OAuth client ID, download the JSON file. This JSON file and some of their variables will be used to create the YAML file that we will use to authenticate in Google Ads API. Finally, you will have to go to the OAuth consent screen section and add your email address as a test user so that you will be able to use your email address to give consent in the OAuth screen:

image

Don't forget to click the "publish" button on the Google Cloud OAuth permission screen.

  1. One of the most important pieces of data we need to get to configure the python file is the developer token. The developer token allows us to access the Google Ads API so we can retrieve relevant keyword data. In order to obtain a developer token, you will need to have a Google Ads Manager account. If you don’t have one, you can create one here (https://ads.google.com/home/tools/manager-accounts/)

  2. Create the account, Sign In, click on tools, then click on API center, and you’ll see the developer token there.

image

  1. Next, we will need to get a customer ID, as it is also needed to configure the file. The customer ID is a unique number used to identify your Google Ads account and is required for authentication. First, you need to create a Google Ads Test Account to use the associated customer ID for testing purposes. You can create a Google Ads test account by clicking here. (https://developers.google.com/google-ads/api/docs/best-practices/test-accounts)

  2. Once you have created your test account, you can find the customer ID in the top right corner of your Google Ads admin account dashboard, as shown below:

image

You will not add this to the yaml file. You will enter the area shown in the image below without -.

image

  1. Afterwards, make a google-ads.yaml file in the same folder as the python file and copy the following code into it. Make sure to add your developer token, client id, and client secret into it: (You can also access the sample yaml file from the repo.)

image

  1. The client_secret, client_id and developer_token is already obtained, so the last thing that we need to obtain to create the YAML file is the refresh token. To get this token you must first download created_user_credentials.py from the repo. Then run the following command in your terminal to use the secrets.json file you downloaded earlier to generate the authentication and renewal token:

python generate_user_credentials.py --client_secrets_path=secrets.json

If the secrets.json and generate_user_credentials.py files are in the same directory, you can run this command directly from the terminal. If the file paths are different, do not forget to specify this.

NOTE: the client secrets is the JSON file that we have downloaded previously when we set up the project on Google Cloud Platform.

  1. This command will generate an URL that you will need to open in your browser with a code. You will have to authenticate this app using a google account you’ve added to the Test Users in OAuth Consent screen earlier.

image

image

  1. After authenticating, the terminal will display a refresh token. Copy and paste this refresh token into the YAML file and your YAML file will be complete!

image

  1. Now you can open the keyword_research.ipynb file from your Jupyter Notebook and start executing all the lines one by one. You will specify the name of your keyword file in this line:

image

There are also helpful instructions in the keyword_research.ipynb file.

About

Keyword Research with Python (Google Ads API + Google Suggestions + Gemini 1.5 Flash)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published