analytics_request {YTAnalytics}R Documentation

Analytics Request Function - YouTube Analytics API

Description

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.

Value

data.frame

Examples

## Not run: 
analytics_request(startDate = "2018-05-01",
                  endDate = "2017-01-01",
                  metrics = "views,comments,likes,dislikes,estimatedMinutesWatched")

## End(Not run)

[Package YTAnalytics version 0.1.0 Index]