Skip to content

Instantly share code, notes, and snippets.

@voltek62
Created September 4, 2018 21:58
Show Gist options
  • Save voltek62/ad9007a007f9fb53bcbcae887c389f80 to your computer and use it in GitHub Desktop.
Save voltek62/ad9007a007f9fb53bcbcae887c389f80 to your computer and use it in GitHub Desktop.
library(searchConsoleR)
# https://dataseolabs.com
## authentication with both GA and SC
options(googleAuthR.scopes.selected =
c("https://www.googleapis.com/auth/webmasters"))
googleAuthR::gar_auth()
## replace with your GA ID
ga_id <- 123456
## date range to fetch
start <- as.character(Sys.Date() - 93)
end <- "2018-07-20"
## Getting the Search Console data
# Fix : rowLimit must be 5000 or lower. Got this: 20000
scdata <- search_analytics("https://data-seo.com",
startDate = start, endDate = end,
dimensions = c("page","query"),
rowLimit = max_results,
aggregationType = "byPage")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment