python-google-search-console-api

Web Application for Easy Use of the Google Search Console API

Some time ago, I created a post demonstrating how to communicate with the Google Search Console API to retrieve up to 25,000 rows of data—significantly more data than the 1,000 rows displayed by Google Search Console. However, configuring the necessary JSON files can be challenging, and not everyone is familiar with the process.

To address this issue, I developed a web application using Python and Streamlit. With this application, you can easily connect to the Google Search Console API and retrieve up to 300,000 rows of data.

How the Python Google Search Console API works

how-google-search-console-api-works

You may be aware that the Google Search Console API has a limit of 25,000 rows per request. What this app does is run several requests, each fetching 25,000 rows, until it reaches a maximum limit of 300,000 rows of data.

Benefits of using this app:

  1. Retrieve significantly more data compared to Google Search Console.
  2. View real-time charts for your Clicks, Impressions, CTR, and Positions.
  3. Apply filters much faster than using Google Search Console or Looker Studio.
  4. See real-time metrics for your filters. For example, you can filter keywords with up to a 5% CTR and instantly view metrics for those keywords.
  5. Easily export all data to an Excel file.
  6. No credentials or data are stored within the application; it acts solely as a connector between the script and your data. When you leave the page, no data is retained.
  7. You can check the full code on Github to verify that nothing is stored.

 How to use the Python Google Search Console API

  • Simply go to the web application.
  • Click on “Log in to Google Search Console.”
  • Insert your credentials.
  • Click on “Grant API Access”.
  • Choose your metrics and click on “Get Data ✨”.

Or if you prefer, clone this repository and run it locally on your machine.

How to run it locally and Change row Limitation

This application has a limit of 300,000 rows of data, which is significantly more than the 25,000 rows we can obtain per request using the GSC API. What this script does is run several requests, each fetching 25,000 rows, until it reaches the 300,000 limit. If your website doesn’t have all the data (which is often the case), the request simply ends sooner.

If you want to retrieve more than 300,000 rows of data, follow these steps:

  • Change three variables: clientSecret, clientId, and redirectUri.
  • For clientSecret and clientId, you’ll need to create new credentials for the Google Search Console API on Google Cloud. Ensure that you create them as OAuth client IDs for a Web Application.
  • redirectUri is the URL where your app will redirect after the user logs in. If you’re running the app locally, it should be something like http://localhost:8501/.

After completing these steps, make one more change in the code.

row_limit = 300000

Work in Progress

This application is fully functional but still a work in progress as I plan to insert new charts and conduct further analysis. I would appreciate any feedback on this application.

About Vinicius Stanula

SEO Specialist, blue belt in Brazilian Jiu Jitsu, I love sports, SEO, technology and cats. I hope to be able to contribute more and more to this SEO community that I love so much.

Leave a Comment

Your email address will not be published. Required fields are marked *