MarkEdmondson1234 / searchConsoleR

R interface with Google Search Console API v3, including Search Analytics.
http://code.markedmondson.me/searchConsoleR/
Other
114 stars 41 forks source link

Possible to call multiple websites and sitemaps? #50

Open danielkupka opened 5 years ago

danielkupka commented 5 years ago

Hi,

first of all, let me say it´s an awesome plugin and easy to use for a newbie.

As per title, I am wondering if its possible to get GSC data from multiple websites at once without duplicating the code.

I tried:

search_analytics(c("https://www.example.com", "https://www.example2.com", .... list_sitemaps(c("https://www.example.com", "https://www.example2.com", ....

For both I receive an error. I could easily duplicate but I plan to do it for at least 50 sites...

Thanks in advance

MarkEdmondson1234 commented 5 years ago

Thanks!

Not out of the box, but the R way would be:

my_websites <- c("https://www.example.com", "https://www.example2.com", ....)

list_of_results <- lapply(my_websites, search_analytics, dimensions = c("page", "query"), ...)

This will give you a list of data.frames.