Check SERP rankings instantly for free with this Python script

author avatar
Matthias Kupperschmidt
12. July 2020
2min read

What's really cool about on-page SEO is its feedback loop. Because, as soon as your changes are indexed, you can see an effect in Google's search results.

You either moved up a bit or down. So you learn if Google liked your changes or not.

With this learning you can apply more changes, get them indexed again and work your way steadily up the SERPs.

Nice - but there is one challenge.

For keyword optimization in a foreign country, you will need a VPN to see the local SERP exactly the way it would look like in that country.

So I did that for a while, but it turned out to be too cumbersome.

I had to change my IP manually each time and then count through the results. It took a lot of time, so I needed a better solution.

My keyword rank tracker would only give me data that was from 12 to 48 hours ago, so that was no solution either. I wanted to know my rankings now and if possible for free, because I'm a freelance SEO and want to keep costs in control.

Recently, I had a look at some SEO API services and noticed that many had a free tier included.

Shortly after, I also stumbled upon Google Colab to write and easily share Python scripts and enjoyed the development experience right from the beginning.

Hence, I built an SEO rank checker script in Python that would instantly check a keyword ranking. It works directly from Google Colab, so no setup-hassle.

This is how it looks like, when you fetch a SERP for a keyword in the UK:


You can use the code too if you follow below steps.

How to get started

  1. Sign up for the free tier on Serpstack.com - The free tier allows for 100 requests per month. It’s an affiliate link. If you ever decide to move to the paid plan, I'll get a commission.
  2. Copy the API key from the Serpstack dashboard.
  3. Make a copy of my Google Colab Python script
  1. Open your copy and fill out the form:
  • api_key - enter the key you copied from Serpstack's dashboard

  • target_query - your keyword

  • target_domain - the domain you want to find, like example.com

  • google_domain - the Google domain you want to search from, like google.co.uk

  • country_code - country code. Here the complete list following the ISO 3166 standard and a few examples:

    CountryCountry Code
    Germanyde
    USAus
    UKgb
    Denmarkdk
    Swedense
  • language - Language code. Here the complete list following ISO 639-1 standard and a few examples:

    CountryLanguage Code
    Germanyde
    USAen
    UKen
    Denmarkda
    Swedensv
  • results - number of results to scrape, from 10 to max. 100

  • device - the search device (mobile, desktop, tablet)

  1. Go to the navigation bar and click on Runtime > Run all

After a few seconds a result should be logged to the bottom of the screen, that looks something like this:

So there you have it. You can instantly check your keyword rankings anywhere for free.

The code is also available in this Github repository.

Let me know on Twitter how it worked for you. ✌️

author avatar
Matthias Kupperschmidt
12. July 2020
2min read
share