Lucky Boost

Boost Traffic & Conversions

Download Data from Webmaster Tools

| 1 Comment

get-webmaster-tool-dataI wrote about download data from webmaster tools in the past (see Exporting Data from Webmaster Tools via API) but Google made changes to its API and there is a much easier way to do this now.

First I need to thank Stephan Schmitz for leaving a comment on the last post about a class he added on to GitHub GWT_CrawlErrors-php. I myself used this a few times and it works very well.

Lately I needed his class again, and I saw he has a new class that will download all data in webmaster tools, even more then what was available the old way described in the last post.

We will be using the php-webmaster-tools-downloads class found on Stephans GitHub account.

First you need to make sure you have a localhost on your computer. My preference is Apache (XAMPP). (Download at apache friends and install.)

Download files from GitHub

Extract folder and locate in your localhost

In the folder you will find 2 folders and 2 files. All change you need to make are in the examples folder.

By running the scripts you will get the following files

  • TOP_PAGES
  • TOP_QUERIES
  • CRAWL_ERRORS
  • CONTENT_ERRORS
  • CONTENT_KEYWORDS
  • LATEST_BACKLINKS
  • INTERNAL_LINKS
  • EXTERNAL_LINKS
  • SOCIAL_ACTIVITY

Each file in the folder has a different example for using the script.

example-simple.php – will download the 9 files for domain specified in row 8

example-downloaded.php – will download all files for all sites in your account. For this to work, you will need to add a folder named “csv” in folder examples

example-tables.php – will only download the file you specified in row 13 (not all 9) for domain in row 8.

example-daterange.php – will download all files for all domain but data will be only for the date range you specified in row 8.

example-language.php – will download one type of file for all domains in account. Data will be based on dates specified in row 11 and headline of table will be in language specified in row 8.

Note: All urls must have a trailing slash

Before you can run any file you need to update rows 4 & 5 in each file you’d like to use. Needs to be changed to your login info

$email = “username@gmail.com”;

$passwd = “******”;

When XAMPP is turned on go to http://localhost/php-webmaster-tools-downloads-master/examples/ in your browser and chose the file you want to run.

Of course you don’t need to stick with the given options, you can play with the different functions to create a file that will give you exactly what you need.

When exporting a lot of data you might get the following error

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\php-webmaster-tools-downloads-master\src\gwtdata.php on line 199

All you need to do is go to htdocs/php-webmaster-tools-downloads-master/src open gwtdata.php in a text editor and change the number on line 160 and 194 (not 199 that is mentioned in the error).

I put together an example of a combination from the examples to show you how easy it is to create your own script tailed for your needs.
Download a specific table by date range

Good luck exporting your data and thanks again to Stephan Schmitz.

One Comment

  1. Pingback: Analytics Edge, ese conector con Excel | El blog de las Madrid Geek Girls

Leave a Reply

Required fields are marked *.