This is the function to make API calls to the YouTube Analytics API. Most other functions in this package are wrappers for this function with some arguments already populated. If none of the other prebuilt functions work for your use case, this is the function to turn to.
Usage
analytics_request(
dimensions = NULL,
metrics = "views,estimatedMinutesWatched",
sort = NULL,
maxResults = 10,
filters = NULL,
startDate = "2000-01-01",
endDate = as.character(Sys.Date()),
ids = "channel==MINE",
currency = NULL,
startIndex = NULL,
includeHistoricalChannelData = NULL,
token = getOption("YouTube_Token")
)
Arguments
- dimensions
String. See https://developers.google.com/youtube/analytics/dimensions for valid arguments.
- metrics
String. See https://developers.google.com/youtube/analytics/metrics for valid arguments.
- sort
String. Specify by which metric/dimensions to sort output if applicable.
- maxResults
Integer. Specify the number of results to return. Maximum is 200.
- filters
String. Specify dimension to filter on if applicable. Ex: video==dQw4w9WgXcQ
- startDate
Required. String specifying start date.
- endDate
Required. String specifying end date.
- ids
Required. Specify the channel. By default the function will specify
"channel==MINE"
- currency
String. Specify currency if applicable
- startIndex
Integer. Specify index of first entity to retrieve, if applicable.
- includeHistoricalChannelData
String. Indicates whether the API response should include channels' watch time and view data from the time period prior to when the channels were linked to the content owner. Only applies to content owner reports. Either 'true' or 'false'.
- token
Required.