The Search Console API allows you to find more keywords than if you were using Search Console through your browser. Here I’ll show you how to get a CSV file with a list of up to 25 000 keywords using Python.
Knowing what keywords visitors have used to find your website on Google is a no brainer. The main strength of Search Console is that it can tell you which keywords resulted in an actual click to your website.
If you already have a verified domain in Search Console, then you could have nearly 18 months of this valuable data waiting for you. Unfortunately, there is only so much data you can access from SC through your browser, but with the API we can uncover vastly more data and keywords
Setting up the Search Console API for Python
If you haven’t already cloned the search console python scrips on Github, that’s where you should start. There’s a few steps to setting up your Google Search Console API, and here you can find the detailed instructions for how to get set up.
Setting up the Python script to download your hidden keywords
So if you’ve successfully setup the Python scripts and got your Google Search Console API working, then it’s time to set up the script that will download your keywords and save them in a CSV file.
Step 1 – In the directory you cloned from Github, open up the top_search_console_keywords.py in your preferred Python interpreter. If you’re new to Python, then check out Codecademy which offers some online courses to get you started with Python.
Step 2 – Required – The first thing you need to change (and maybe the only thing) is the ‘SITE_URL’ variable which is currently set to ‘https://digitalhop.co.uk’. If you followed the setting up your Google Search Console API tutorial, then you will remember the part about using the full URL and having it verified in Search Console to be able to make it work correctly. So go ahead and replace my url with your own.
Step 3 – Optional – You can change the start_date and end_date variables to a time period that works better for you. It is automatically set to 16 months up to today, which might be fine for most sites. But if your site has recently undergone big changes, then you might only be interested in a more recent time period. Enter dates in the form ‘year-mm-dd’
Step 4 – Optional – The row_limit is the amount of keywords that Google Search Console API will return. 25 000 is the most. You might want to lower this if you don’t like big numbers. But it would be best to leave it as is and edit the CSV file later if you looking to reduce the amount of keywords.
Step 5 – Optional – The click_limit variable will determine how many times a keyword had to have been clicked on from a search on Google that landed on your site. If you make this too low, you might get lots of low quality keywords that were once off clicks or don’t have a lot of volume.
Step 6 – Run the script. If all goes well, it will add a CSV file to your keywords folder in the data folder. The CSV file has the keywords, the click through rate for that keyword and the amount of clicks it received. By default it is listed from highest clicks to lowest clicks.
What to do with your keyword data now
With this list of keywords you now have a good idea of what keywords are driving traffic to your site from Google. With this you can start to group keywords into categories that help to highlight the intent(what the user was looking for). You can also use these keywords to supplement your current keyword tracking in other tools.
If you are like me, you might want to know more about these keywords and which landing pages specifically they are sending users to and in what volumes. This could help you to strengthen your keyword strategies for those pages. I’ll be adding more scripts to help you do this soon. So keep checking back and let me know if you’re interested in the comments below.