{"id":224157,"date":"2020-03-28T09:48:57","date_gmt":"2020-03-28T04:18:57","guid":{"rendered":"http:\/\/54.251.169.215\/?p=224157"},"modified":"2020-04-18T17:10:21","modified_gmt":"2020-04-18T11:40:21","slug":"how-to-query-the-google-search-console-api","status":"publish","type":"post","link":"https:\/\/qcsglobal.com\/blogs\/how-to-query-the-google-search-console-api\/","title":{"rendered":"How to Query the Google Search Console API"},"content":{"rendered":"\n<div>\n<p>If you\u2019ve been an SEO for even a short time, you\u2019re likely familiar with <a href=\"https:\/\/search.google.com\/search-console\/about\">Google Search Console<\/a> (GSC). It\u2019s a valuable tool for getting information about your website and its performance in organic search. That said, it does have its limitations.<\/p>\n<p>In this article, you\u2019ll learn how to get better-connected data out of Google Search Console as well as increase the size of your exports by 400%.<\/p>\n<h2>Google Search Console limitations<\/h2>\n<p>While GSC has a number of sections, we\u2019ll be focusing on the \u201cPerformance\u201d report. From the GSC dashboard, there are two ways you can access this report:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>Once inside the \u201cPerformance\u201d report, data for queries and pages can be accessed:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/d2v4zi8pl64nxt.cloudfront.net\/how-to-query-google-search-console-api\/5e67fc75a479e6.67960279.png\" width=\"624\" height=\"283\" data-image=\"1cdi0fveyn1e\" \/><\/figure>\n<p>This reveals one of the issues with GSC: Query and page data is separated.<\/p>\n<p>In other words, if I want to see the queries a specific page is ranking for, I have to first click \u201cPages,\u201d select the page, and then click \u201cback\u201d to \u201cQueries.\u201d It\u2019s a very cumbersome experience.<\/p>\n<p>The other (two-part) issue is with exporting:<\/p>\n<ul>\n<li>Performance data for queries and pages must be exported separately.<\/li>\n<li>Exports are limited to 1,000 rows.<\/li>\n<\/ul>\n<p>We\u2019ll look to solve these issues by utilizing the GSC API.<\/p>\n<h2>What is the Google Search Console API?<\/h2>\n<p>Now we know the GSC user interface does have limitations: Connecting query data with page data is tricky, and exports are limited.<\/p>\n<p>If the GSC UI represents the factory default, the GSC API represents our custom settings. It takes a bit more effort, but gives us more control and opens up more possibilities (at least in the realm of query and page data).<\/p>\n<p>The GSC API is a way for us to connect to the data within our account, make more customized requests, and get more customized output. We can even bypass those factory default settings like exports limited to 1,000 rows, for instance.<\/p>\n<h2>Why use it?<\/h2>\n<p>Remember how I said earlier that query and page data is separated in the \u201cvanilla\u201d GSC UI? Well, with the API, we can connect query data with the page that query ranks for, so no more clicking back and forth and waiting for things to load.<\/p>\n<p>Additionally, we saw that exports are limited to 1,000 rows. With the API, we can request <strong>up to 5,000 rows, an increase of 400%!<\/strong><\/p>\n<p>So let\u2019s hook in, make our request, and get back a more robust and meaningful data set.<\/p>\n<h2>Setup<\/h2>\n<p>Log in to the appropriate GSC account <a href=\"https:\/\/developers.google.com\/webmaster-tools\/search-console-api-original\/v3\/searchanalytics\/query\">on this page<\/a> (upper right corner). For instance, if my website is example.com and I can view that Search Console account under <a href=\"http:\/\/tracking.feedpress.it\/mailto:admin@email.com\">admin@email.com<\/a>, that\u2019s the account I\u2019ll sign into.<\/p>\n<p>Enter the URL of the appropriate GSC account:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/d2v4zi8pl64nxt.cloudfront.net\/how-to-query-google-search-console-api\/5e67ff3f7a8dc6.37404526.png\" width=\"366\" height=\"313\" data-image=\"xvpn99fd47bj\" \/><\/figure>\n<p>Set up your request:<\/p>\n<ol>\n<li>Set startDate. This should be formatted as: YYYY-MM-DD.<\/li>\n<li>Set endDate.<\/li>\n<li>Set dimensions. A dimension can be:\n<ul>\n<li>query<\/li>\n<li>page<\/li>\n<li>device<\/li>\n<li>and\/or country<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ul>\n<li>Set filters (optional). A filter must include:\n<ul>\n<li>dimension (a dimension can be: query, page, device, or country)<\/li>\n<li>operator (an operator can be: contains, notContains, equals, notEquals)<\/li>\n<li>expression (an expression can be any value associated with the dimensions)<\/li>\n<\/ul>\n<\/li>\n<li>Set the rowLimit. With the GSC API, you can request up to 5,000!<\/li>\n<\/ul>\n<p>The page shared in step one makes all of this setup pretty easy, but it can be tedious and even confusing for some. I\u2019ve done all the fussing for you and have created JSON you can edit quickly and easily to get the API return you\u2019d like.<\/p>\n<h3>Unfiltered request<\/h3>\n<p>The following request will be unfiltered. We\u2019ll set our preferred dates, dimensions, and a row limit, and then make our request.<\/p>\n<p>The order in which you place your dimensions is the order in which they\u2019ll be returned.<\/p>\n<p>The API will return data for desktop, mobile, and tablet, separated out. The numbers you see in the GSC user interface \u2014 clicks, for instance \u2014 are an aggregate of all three (unless you apply device filtering).<\/p>\n<p>Remember, your dimensions can also include \u201ccountry\u201d if you\u2019d like.<\/p>\n<p>{<\/p>\n<p>&#8220;startDate&#8221;: &#8220;2019-11-01&#8221;,<\/p>\n<p>&#8220;endDate&#8221;: &#8220;2020-01-31&#8221;,<\/p>\n<p>&#8220;dimensions&#8221;:<\/p>\n<p>[<\/p>\n<p>&#8220;query&#8221;,<\/p>\n<p>&#8220;page&#8221;,<\/p>\n<p>&#8220;device&#8221;<\/p>\n<p>],<\/p>\n<p>&#8220;rowLimit&#8221;: 3000<\/p>\n<p>}<\/p>\n<h3>Filtered request<\/h3>\n<p>This version of our request will include filters in order to be more specific about what is returned.<\/p>\n<p>Filters are stated as dimension\/operator\/expression. Here are some examples to show what\u2019s possible:<\/p>\n<ul>\n<li>query contains go fish digital<\/li>\n<li>page equals https:\/\/gofishdigital.com\/<\/li>\n<li>device notContains tablet<\/li>\n<\/ul>\n<p>It looks like you can only apply one filter per dimension, just like in the normal GSC user interface, but if you know differently, let us know in the comments!<\/p>\n<p>{<\/p>\n<p>&#8220;startDate&#8221;: &#8220;2019-11-01&#8221;,<\/p>\n<p>&#8220;endDate&#8221;: &#8220;2020-01-31&#8221;,<\/p>\n<p>&#8220;dimensions&#8221;:<\/p>\n<p>[<\/p>\n<p>&#8220;query&#8221;,<\/p>\n<p>&#8220;page&#8221;,<\/p>\n<p>&#8220;device&#8221;<\/p>\n<p>],<\/p>\n<p>&#8220;dimensionFilterGroups&#8221;:<\/p>\n<p>[<\/p>\n<p>{<\/p>\n<p>&#8220;filters&#8221;:<\/p>\n<p>[<\/p>\n<p>{<\/p>\n<p>&#8220;dimension&#8221;: &#8220;device&#8221;,<\/p>\n<p>&#8220;operator&#8221;: &#8220;notContains&#8221;,<\/p>\n<p>&#8220;expression&#8221;: &#8220;tablet&#8221;<\/p>\n<p>}<\/p>\n<p>]<\/p>\n<p>}<\/p>\n<p>],<\/p>\n<p>&#8220;rowLimit&#8221;: 3000<\/p>\n<p>}<\/p>\n<p>Choose a template, unfiltered or filtered, and fill in your custom values (anything after a colon should be updated as your own value, unless you like my presets).<\/p>\n<h2>Execute the request<\/h2>\n<p>So there you have it! Two request templates for you to choose from and edit to your liking. Now it\u2019s time to make the request. Click into the \u201cRequest body\u201d, select all, and paste in your custom JSON:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/d2v4zi8pl64nxt.cloudfront.net\/how-to-query-google-search-console-api\/5e67fc77149138.19607519.png\" width=\"365\" height=\"314\" data-image=\"71wa44czcyvj\" \/><\/figure>\n<p>This is where you could manually set up your request keys and values, but as I stated earlier, this can be tedious and a little confusing, so I\u2019ve done that work for you.<\/p>\n<p>Scroll down and click \u201cExecute.\u201d You may be prompted to sign-in here as well.<\/p>\n<p>If everything was entered correctly and the request could be satisfied, the API will return your data. If you get an error, audit your request first, then any other steps and inputs if necessary.<\/p>\n<p>Click into the box in the lower right (this is the response from the API), select all, and copy the information.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/d2v4zi8pl64nxt.cloudfront.net\/how-to-query-google-search-console-api\/5e67fc77c59f00.94036289.png\" width=\"624\" height=\"331\" data-image=\"62v79mwr6pmb\" \/><\/figure>\n<h2>Convert from JSON to CSV<\/h2>\n<p>Excel or Sheets will be a much better way to work with the data, so let\u2019s convert our JSON output to CSV.<\/p>\n<p>Use a converter <a href=\"https:\/\/konklone.io\/json\/\" target=\"_blank\" rel=\"noopener noreferrer\">like this one<\/a> and paste in your JSON output. You can now export a CSV. Update your column headers as desired.<\/p>\n<h2>Query your own data<\/h2>\n<p>Most SEOs are pretty comfortable in Excel, so you can now query your request output any way you\u2019d like.<\/p>\n<p>One of the most common tasks performed is looking for data associated with a specific set of pages. This is done by adding a sheet with your page set and using VLOOKUP to indicate a match.<\/p>\n<p>The API output being in a spreadsheet also allows for the most common actions in Excel like sorting, filtering, and chart creation.<\/p>\n<h2>Get more out of Google Search Console<\/h2>\n<p>GSC offers important data for SEOs, and the GSC API output offers not only more of that data, but in a format that is far less cumbersome and more cohesive.<\/p>\n<p>Today, we overcame two obstacles we often face in the standard GSC user interface: the query\/page connection and limited exports. My hope is that utilizing the Google Search Console API will take your analyses and insights to the next level.<\/p>\n<p>While my JSON templates will cover the most common scenarios in terms of what you\u2019ll be interested in requesting, <a href=\"https:\/\/developers.google.com\/webmaster-tools\/search-console-api-original\/v3\/searchanalytics\/query\" target=\"_blank\" rel=\"noopener noreferrer\">Google does offer documentation<\/a> that covers a bit more ground if you\u2019re interested.<\/p>\n<p>Do you have another way of using the GSC API? Is there another API you commonly use as an SEO? Let me know in the comments!<\/p>\n<\/div>\n\n<p><a href=\"http:\/\/tracking.feedpress.it\/link\/9375\/13363061\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve been an SEO for even a short time, you\u2019re likely familiar with Google Search Console (GSC). It\u2019s a valuable tool for getting information about your website and its performance in organic search. That said, it does have its limitations. In this article, you\u2019ll learn how to get better-connected data out of Google Search [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":224158,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[10,13],"tags":[],"_links":{"self":[{"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/posts\/224157"}],"collection":[{"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/comments?post=224157"}],"version-history":[{"count":1,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/posts\/224157\/revisions"}],"predecessor-version":[{"id":224310,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/posts\/224157\/revisions\/224310"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/media\/224158"}],"wp:attachment":[{"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/media?parent=224157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/categories?post=224157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qcsglobal.com\/blogs\/wp-json\/wp\/v2\/tags?post=224157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}