Function Quick Guide

Search analytics

Website admin

Sitemaps

Error listings

Authentication functions from googleAuthR

Guide

Install googleAuthR from CRAN

install.packages("googleAuthR")
library(searchConsoleR)

Install searchConsoleR from github using devtools.

devtools::install_github("MarkEdmondson1234/searchConsoleR")
library(searchConsoleR)

Work flow always starts with authenticating with Google.

gar_auth()

Your browser window should open up and go through the Google sign in OAuth2 flow. Verify with a user that has Search Console access to the websites you want to work with.

Check out the documentation of any function for a guide on what else can be done.

?gar_auth

If it works, you should see a list of your websites in the Search Console via:

sc_websites <- list_websites()
sc_websites

We’ll need sc_websites$siteUrl for the majority of the other functions.

Most people will find the search analytics most useful. All methods from the web interface are available. Here is an example query:

gbr_desktop_queries <- 
    search_analytics("http://example.com", 
                     "2015-07-01", "2015-08-01", 
                     c("query", "page"), 
                     dimensionFilterExp = c("device==DESKTOP","country==GBR"), 
                     searchType="web", rowLimit = 100)

dimensionFilterExp

Filter your API results using this format: filter operator expression

Filter can be one of:

Operator can be one of ~~, ==, !~, != where the symbols mean:

Expression for page or query if freeform.

Expression for country must be the three letter country code as per the [the ISO 3166-1 alpha-3] standard. e.g. GBR

Expression for device must be one of:

You can have multiple AND filters by putting them in a character vector.

c("device==DESKTOP","country==GBR")

OR filters aren’t supported yet in the API.