I'm trying to download the 'Top Queries' CSV and am having a few issues. I started off doing this via Python and I was getting GWMT to send me a CSV with all the results (and also made a script to automatically place it into an SQL database) but stopped using Python for this problem when I realized that I could not set the date range. That would be the first question (as it would make the next question irrelevant):
Does anyone know a way to query specific date ranges using Python to access the Google API? Like I said, I can download everything else but cannot set the date range (automatically gives you a month's worth).
Secondly, in term of the PHP solution, I setup XAMPP on my computer and got that working swimmingly but as soon as I started trying to download CSV's (using code from this link) but every time I load it in the Browser, no CSV is downloaded. There are few reasons why I think this might be:
Weirdly enough, when I did the OAuth2 yesterday for Python, it worked but then when I started working this morning, the credential had been deleted? Should I just create and go through the same authentication process for Python (which gave authorization for the web property) again to allow the csv to be downloaded?
Anyways, any help on this would be greatly appreciated as the alternative is manual pulling and loading into SQL!!!! :S
The script you linked to is not supported by Google, never was, and it relies on Oauth1 which is deprecated.
Currently the only official way to download Search Queries data is via the Search Queries API, although it's in limited mode, meaning we're (Google) testing it with people who showed interest and subscribed when we announced we'll launch it in limited beta. Once testing is done, we'll very likely launch it for the general public, but I don't have a timeframe for that.
You can find the currently supported methods and more information about them in the API Explorer for Search Console (former Webmaster Tools)
For webmasters.searchanalytics.query it currently says:
[LIMITED ACCESS] Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days. When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With