Tuesday, November 28, 2023
HomeWeb AnalysisHow to get 1000+ search queries in search analytics?

How to get 1000+ search queries in search analytics?

Google’s webmaster tools have been renamed to Search Console, and the screen for browsing search queries has also been renewed in the form of “Search Analytics”.

Search analytics has the advantage of making it easier to understand search queries and the landing pages and devices associated with them. I’m starting to hear the voice that it’s gone. Regarding the upper limit of search queries, there is information that it is possible to retrieve up to 5,000 by using the API, but how should I actually use the API? I don’t think there is an important article written about.

Therefore, I created a tool in this blog that uses the API that acquires search analytics data in the Search Console API.

Search Console API – Search Analytics

What you can do with API

In addition to acquiring the query data created this time, you can use the API to register and delete sites, send sitemaps, and acquire crawl error information. By using these functions, when managing a large number of sites on a large site, you will be able to perform batch registration to Search Console, batch submission of sitemaps, and monitoring of crawl errors. Currently, it seems that it is not possible to send the index using Fetch as Google, but when the function is added in the future, cooperation with CMS etc. is also possible.

Information about APIs

The developer help documentation for the Search Console API can be found at

Google Developers – Search Console API (Webmaster Tools API)

is in

However, the information here is not enough to write a program. I myself spent about two days developing the tool through trial and error. The library itself

  • Python
  • Go
  • JavaScript
  • .NET
  • Objective-C
  • PHP
  • Java

Although it is provided in, the sample code is only a simple Python version. This time, we used the JavaScript version of the library, partly because it was troublesome to manage the tokens of each user. However, when I tried to get the query data using the library, an error related to Cross Origin occurred and I couldn’t proceed, so I ended up generating an XMLHttpRequest object and implementing it myself from the request part. increase.

This could have been easily implemented by using a server-side language such as Python or PHP.

I’d like to share the implementation code somewhere after I’ve refactored it a bit more.

How to use the created tool

The created tool is

Available from First, click the “Authenticate” button to authenticate. After completing the authentication, you will get a list of sites registered in the account. The site data obtained via the API will be entered in the “target site” combo box.

Search criteria is

Search entry Required/Optional explanation
Target site Required Select the site you want to get search queries from. Sites of choice, after authentication
Data acquisition period Required Set the period you want to include in the acquired data.
Number of acquisitions Any Set the upper limit of the data to retrieve. A value between 1 and 5,000 can be specified. If omitted, the default value of 1,000 is used.
search type Any Specify which search type data to retrieve: Web, Image, or Video. Web is the default.
dimension Any Set in which unit the search data is divided. Note that increasing the number of items will increase the number of data rows and may not fit within the maximum number of rows of 5,000.

It has become. After specifying the necessary items among these, click the “Data Acquisition” button or “CSV Output” button to acquire the data. The data acquisition process takes a little time, and the display while loading is not implemented, so you may be worried that it is being processed, but please wait. It should take several tens of seconds to finish loading, so if there is no change after a few minutes, reload the screen and try again. If it still does not work , please contact us from the inquiry form .

Current function

As for the current function, it is only possible to change the upper limit of the number of acquisitions that cannot be done from the screen UI, and there is no merit to using this tool other than that. Nonetheless, although it is written on various sites that you can use the API to retrieve more than 1,000 search queries, there is nowhere written how to use the API easily. I think there is a need for this function.

In addition, in order to measure the usage frequency of the tool, event data is sent to Google Analytics at the timing of Google authentication and the timing of clicking the data output button (including the CSV button). We do not send the account information used for authentication or the information of the website from which data is acquired to Google Analytics or any other place, including our own site.

Future function addition (planned)

At the moment, there are no plans to add functions, but if there are many users and there are requests for other functions, we would like to consider responding to them one by one.

However, as far as the current Search Analytics API specifications are concerned, the only function that can be added is the filtering function of the output results. In addition, I think it would be ideal if we could automatically use the filtering function for each page to obtain all data of 5,000 or more items (In that case, there seems to be a limit to JavaScript processing, so implementation on the server side likely to be).


Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Popular Posts

Most Popular

Recent Comments