What we will build?
We'll use Google Ads API to build a keyword Research tool that allows you to get keyword suggestions and metrics like Search volume data , CPC and Competition based on user input.
Examples of keyword tools:
If you go to keywordtool.io, you can search for a keyword, it will give you hundreds of keyword suggestions.
It is considered one of the best free keyword tools. (But it’s not totally Free)
Another example is H-supertools.
I developed H-supertools from scratch, and today this website is one of my main income streams.
Today, In this post, I will reveal how you can build similar tools, so maybe you can turn it also into an income source too!
How does our Keyword Tool works?
It's a simple C# console application. When you run it, you'll have two options:
- Authenticate with Google Ads API
- Perform keyword research
Let's perform Keyword Research and search for "C#"
After the search, our tool gets back ~500 keyword ideas with search volume data, competition, and CPC values.
Of course, In my case, it's a simple console application (just for simplicity reasons) But we can use and implement the same code in any type of applications like mobile, web, or even a desktop application.
Let's Start Coding!
Step 1: Setup Your Google Console Account
So, our first step is to go to Google cloud console and login with your Gmail account.
After you login, create a project, and then click on Enable APIs
Now search for “Google ad API” and Enable The API
Step 2: Create OAuth Credentials to access Google Ads API
Finish the wizard, then you will be able to get the client and secret IDs as shown in the images below:
We will use these Keys to authenticate our application.
Before we continue, if you are that person who loves to watch videos instead of reading long posts, you can check the full tutorial here:
Google Ads API Authentication Code
Open KeywordIdeasGoogleAPI.cs Class in our Project.
You will see we have two methods.
I found the Google ads API authentication code on Github.
I tweaked it a little bit and Made it simpler for you to understand and use 😃
I will run the application.
Hit 1 to authenticate.
It will ask you for the client ID and secret
Copy From Google Console, Paste, hit enter, and authenticate your Gmail account.
Now it will prompt you to copy authentication keys:
Copy and paste these keys in the app.config file in your project files.
How To Get The Google Ads Developer Token
Now the next step is to get the developer token. As You can see, we need to set the developer token in the app.config file.
For this, you will need to create a Google ads Manager Account.
Click Here To Create a Google ads Manager Account.
Create one, Sign In, and click on tools, then click on API center and you'll see the developer token there.
We got the Token, Paste in the app.config file, and we are ready!
Perform a Keyword Research Test
In the Google Ads API, we have the keyword ideas service.
It is the service I used to perform keyword research.
The Sample Code mentioned on the page will not work directly, this is why again, I tweaked and simplified it so you can run easily and smoothly. (I think I deserve a Heart and maybe a Unicorn 😅)
The Search Method
In the main application, create an instance of our class KeywordIdeasGoogleAPI.
Create a new object of Google client, and pass it to the search method with other parms: locationId, customerId, languageId, and the searchTerm.
How to get the customer id?
Create a Google Ads Test Account
Login, and you will see a red message showing that this is a test account, just click and copy the customer ID as shown below:
Make sure to remove the dashes and keep only the numbers when you paste in your code.
we still have locationId and languageId.
Find a list of Location IDs by clicking here. And Find a list of Language Ids here.
For Example, "English" Id is 1000, and "New York" Id is 21167.
Now we are ready to perform a keyword research!
Run the application again
Let's say, we wanna search for this keyword: “subscribe to my channel.” 😅
Hit Enter, and you will see the Magic🎩
Note: CPC Bids means that advertisers are paying these numbers to advertise on Google.
Check The Full Project Here on Github.
If you did it. Congratulations 🥳
The Google Ads API is free but has some limitations.Did you know you can use the Free Google Suggestions API To Develop a Keyword Research Tool with no limits! Yes! If you wanna learn how. Check this post.
Top comments (1)
So useful ! Thanks Hasan. Any thoughts on how to retrieve keyword search volume data from the past 4 years?