Use Google Search Console as a data source

Resources

Data Source Type REST/URL data source
Authentication Google OAuth Token Authentication
Sample Query https://www.googleapis.com/webmasters/v3/sites/<Your-Site-URL>
API Documentation Google Search Console API documentation

Step-by-Step

Creating a data source using Google Search Console

To create a data source using Google Search Console, you need to accomplish three tasks:

  1. Go to the New Data Source page in Klipfolio.
  2. Authenticate with Google.
  3. Craft a query to get a list of your site URLs.
  4. Craft a second query that includes your site URL to get the data you want to use. Follow the steps below for detailed instructions.

Start the data source creation process

In Klipfolio, go to the New Data Source page and select Google Search Console from the list. If you don't see Google Search Console in the list, select REST/URL.

Authenticate with Google

  • Click the Connect new account link.
  • Enter your Google username and password when prompted.

Craft a query to get a list of your site URLs

Get started with a GET request and get a list of your site URLs, and then use your Site URL to make a POST request to get metrics about that site.

To list all sites
https://www.googleapis.com/webmasters/v3/sites/

  1. At Query URL, enter https://www.googleapis.com/webmasters/v3/sites/ 
  2. Leave the Data Format as JSON.
  3. At Method select GET.
  4. Select Get Resource.
  5. Choose a site URL from the response and save it on your notepad for step two.

Craft a second query to get the data you want to use

Now that you have your Site URL, it's time to make a POST request to get your Google Search Console data. Here is an example query to get you started:

Top Pages in Last 30 Days

  1. At Query URL, enter https://www.googleapis.com/webmasters/v3/sites/https%3a%2f%2fwww.acme.com%2f/searchAnalytics/query
    Note: Site URL must be URL-encoded. For example, the URL-encoded form of https://www.acme.com/ is https%3a%2f%2fwww.acme.com%2f
  2. Leave the Data Format as JSON.
  3. At Method select POST.
  4. Type the Body as required by the resource (see Google Search Console API documentation). For this example, Top Pages in the last 30 days, the body would look like this:
    Post Body:
    {
    "startDate": "{date.add(-32).format('yyyy-MM-dd')}",
    "endDate": "{date.add(-3).format('yyyy-MM-dd')}",
    "dimensions": ["page"],
    "rowLimit": 20
    }
  5. In the Query Parameters section, set the Parameters as follows:
    • Under Name type Content-Type
    • Under Value type application/json
    • Under Type select Header
  6. Once you have completed your query, click Get Resource.

To customize your query, refer to the Google Search Console API documentation. It provides a list of Google Search Console resource types and their supported methods.

Tip! Get started by building your query in the Google Search Console's API console and then use the query that you built there in Klipfolio.

Related Links