search_analytics: Query search traffic keyword data

Description Usage Arguments Details Value See Also Examples

View source: R/getData.R

Description

Download your Google SEO data.

Usage

1
2
3
4
5
search_analytics(siteURL, startDate = Sys.Date() - 93,
  endDate = Sys.Date() - 3, dimensions = NULL, searchType = c("web",
  "video", "image"), dimensionFilterExp = NULL,
  aggregationType = c("auto", "byPage", "byProperty"), rowLimit = 1000,
  prettyNames = TRUE, walk_data = c("byBatch", "byDate", "none"))

Arguments

siteURL

The URL of the website you have auth access to.

startDate

Start date of requested range, in YYYY-MM-DD.

endDate

End date of the requested date range, in YYYY-MM-DD.

dimensions

Zero or more dimensions to group results by: "date", "country", "device", "page" , "query" or "searchAppearance"

searchType

Search type filter, default 'web'.

dimensionFilterExp

A character vector of expressions to filter. e.g. ("device==TABLET", "country~~GBR")

aggregationType

How data is aggregated.

rowLimit

How many rows to fetch. Ignored if walk_data is "byDate"

prettyNames

If TRUE, converts SO 3166-1 alpha-3 country code to full name and creates new column called countryName.

walk_data

Make multiple API calls. One of ("byBatch","byDate","none")

Details

startDate: Start date of the requested date range, in YYYY-MM-DD format, in PST time (UTC - 8:00). Must be less than or equal to the end date. This value is included in the range.

endDate: End date of the requested date range, in YYYY-MM-DD format, in PST time (UTC - 8:00). Must be greater than or equal to the start date. This value is included in the range.

dimensions: [Optional] Zero or more dimensions to group results by.

The grouping dimension values are combined to create a unique key for each result row. If no dimensions are specified, all values will be combined into a single row. There is no limit to the number of dimensions that you can group by apart from searchAppearance can only be grouped alone. You cannot group by the same dimension twice.

Example: c('country', 'device')

dimensionFilterExp: Results are grouped in the order that you supply these dimensions. dimensionFilterExp expects a character vector of expressions in the form: ("device==TABLET", "country~~GBR", "dimension operator expression")

searchType: [Optional] The search type to filter for. Acceptable values are:

aggregationType: [Optional] How data is aggregated.

See the API documentation to learn how data is calculated differently by site versus by page. Note: If you group or filter by page, you cannot aggregate by property. If you specify any value other than auto, the aggregation type in the result will match the requested type, or if you request an invalid type, you will get an error. The API will never change your aggregation type if the requested type is invalid. Acceptable values are:

batchType: [Optional] Batching data into multiple API calls

Value

A dataframe with columns in order of dimensions plus metrics, with attribute "aggregationType"

See Also

Guide to Search Analytics: https://support.google.com/webmasters/answer/6155685 API docs: https://developers.google.com/webmaster-tools/v3/searchanalytics/query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

   library(searchConsoleR)
   scr_auth()
   sc_websites <- list_websites()
   
   default_fetch <- search_analytics("http://www.example.com")

   gbr_desktop_queries <-
       search_analytics("http://www.example.com",
                         start = "2016-01-01", end = "2016-03-01",
                         dimensions = c("query", "page"),
                         dimensionFilterExp = c("device==DESKTOP", "country==GBR"),
                         searchType = "web", rowLimit = 100)

   batching <-
        search_analytics("http://www.example.com",
                         start = "2016-01-01", end = "2016-03-01",
                         dimensions = c("query", "page", "date"),
                         searchType = "web", rowLimit = 100000,
                         walk_data = "byBatch")

  
## End(Not run)

searchConsoleR documentation built on Sept. 6, 2019, 5:02 p.m.