Google Webmaster tools now allows access to “search queries” data. Using a open source Python script from the webmaster-tools-downloads project, you can now dowload the data in CSV format.
“Search queries data is not currently available via the Webmaster Tools API, which has been a common API user request that we’re considering for the next API update,” notes Jonathan Simon, Webmaster Trends Analyst.
“You could easily configure these scripts to be run daily or monthly to archive and view your search queries data across larger date ranges than the current one month of data that is available in Webmaster Tools, for example, by setting up a cron job or using Windows Task Scheduler,” explains Simon.
Simon notes that the following script example includes user name and password credentials within the script itself. If you plan to run this in a production environment you should follow security best practices like using encrypted user credentials retrieved from a secure data storage source. The script itself uses HTTPS to communicate with the API to protect these credentials.
For those, need access to search queries data right now, here are two ways to get the data:
If you just want to download your search queries data in a .csv file without uploading the data to a Google spreadsheet use example-simple-download.py.
For, downloading search queries data and uploading it to a Google Spreadsheet in Google Docs, you can use the search queries downloader Python script example-create-spreadsheet.py as shown in the example below:
- “If Python is not already installed on your machine, download and install Python.
- Download and install the Google Data APIs Python Client Library.
- Create a folder and add the downloader.py script to the newly created folder.
- Copy the example-create-spreadsheet.py script to the same folder as downloader.py and edit it to replace the example values for “website,” “email” and “password” with valid values for your Webmaster Tools verified site.
- Open a Terminal window and run the example-create-spreadsheet.py script by entering “python example-create-spreadsheet.py” at the Terminal window command line:
- Visit Google Docs to see a new spreadsheet containing your search queries data,” explaind Simon.