Title: | Wrapper for 'YouTube Analytics' API |
---|---|
Description: | Simplify working with the 'YouTube Analytics' API <https://developers.google.com/youtube/analytics>. Collect data for your channel including geography, traffic sources, time period, etc. |
Authors: | Jake Davis [aut, cre, cph] |
Maintainer: | Jake Davis <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2025-02-19 05:29:20 UTC |
Source: | https://github.com/davisj95/ytanalytics |
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.
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") )
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") )
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 |
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. |
data.frame
## Not run: analytics_request(startDate = "2018-05-01", endDate = "2017-01-01", metrics = "views,comments,likes,dislikes,estimatedMinutesWatched") ## End(Not run)
## Not run: analytics_request(startDate = "2018-05-01", endDate = "2017-01-01", metrics = "views,comments,likes,dislikes,estimatedMinutesWatched") ## End(Not run)
Returns top cities by views. Data is only available after January 1, 2022.
channel_cities(...)
channel_cities(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_cities() ## End(Not run)
## Not run: channel_cities() ## End(Not run)
Returns top countries by views
channel_countries(...)
channel_countries(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_countries() ## End(Not run)
## Not run: channel_countries() ## End(Not run)
Returns age and gender demographics
channel_demographics(...)
channel_demographics(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_demographics() ## End(Not run)
## Not run: channel_demographics() ## End(Not run)
Returns top devices by views
channel_devices(...)
channel_devices(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_devices() ## End(Not run)
## Not run: channel_devices() ## End(Not run)
Return channel data split by live & on demand.
channel_live_onDemand(...)
channel_live_onDemand(...)
... |
Addt. arguments passed to |
data.frame()
## Not run: channel_live_onDemand() ## End(Not run)
## Not run: channel_live_onDemand() ## End(Not run)
Returns the type of page or application where video playbacks occurred.
channel_playback_location(...)
channel_playback_location(...)
... |
Addt. arguments passed to |
For more information, refer to https://developers.google.com/youtube/analytics/dimensions#Playback_Location_Dimensions
data.frame
## Not run: channel_playlist_location() ## End(Not run)
## Not run: channel_playlist_location() ## End(Not run)
Returns all playlists in channel.
channel_playlists(...)
channel_playlists(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_playlists() ## End(Not run)
## Not run: channel_playlists() ## End(Not run)
Returns top sharing services by views
channel_sharing_services(...)
channel_sharing_services(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_sharing_services() ## End(Not run)
## Not run: channel_sharing_services() ## End(Not run)
#' @description Returns high level video stats.
channel_stats(...)
channel_stats(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_stats() ## End(Not run)
## Not run: channel_stats() ## End(Not run)
#' @description Returns the subscription status of channel views.
channel_subscription_status(...)
channel_subscription_status(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_subscription_status() ## End(Not run)
## Not run: channel_subscription_status() ## End(Not run)
Returns channel views by day or month.
channel_time_period( period = "day", endDate = as.character(format(Sys.Date(), "%Y-%m-01")), ... )
channel_time_period( period = "day", endDate = as.character(format(Sys.Date(), "%Y-%m-01")), ... )
period |
Required. Time period to breakdown data by. Supported values are
|
endDate |
Required. String. Data returned up until the last day specified,
so for monthly period the end date must end with a day of |
... |
Addt. arguments passed to |
data.frame
## Not run: channel_time_period() ## End(Not run)
## Not run: channel_time_period() ## End(Not run)
Returns top videos by views
channel_top_videos(...)
channel_top_videos(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_top_videos() ## End(Not run)
## Not run: channel_top_videos() ## End(Not run)
Returns top traffic sources by views. Check out https://developers.google.com/youtube/analytics/dimensions#Traffic_Source_Dimensions for more information.
channel_traffic_details(trafficType = "EXT_URL", ...)
channel_traffic_details(trafficType = "EXT_URL", ...)
trafficType |
Required. String. Type of traffic source. |
... |
Addt. arguments passed to |
data.frame
## Not run: channel_traffic_sources() ## End(Not run)
## Not run: channel_traffic_sources() ## End(Not run)
Returns top traffic sources by views
channel_traffic_sources(...)
channel_traffic_sources(...)
... |
Addt. arguments passed to |
data.frame
## Not run: channel_traffic_sources() ## End(Not run)
## Not run: channel_traffic_sources() ## End(Not run)
Returns all videos in channel. Note: As of July 2023, the YouTube Data API fails to return ALL videos on a channel by getting all videos from the "uploads" playlist for large YouTube channels. As a result this function's work-around is to pull all additional playlists from the channel, pull all video lists from all playlists, and append the result to the uploads return.
channel_videos(token = getOption("YouTube_Token"))
channel_videos(token = getOption("YouTube_Token"))
token |
YouTube token |
data.frame
## Not run: channel_videos() ## End(Not run)
## Not run: channel_videos() ## End(Not run)
This is a function to make API calls to the YouTube Data API for channel specific data.
While it can be called directly, it is primarily intended to help get lists of videos within
a channel. For more in-depth use of the Data API, please refer to tuber
. For
more details on the following arguments, please refer to
https://developers.google.com/youtube/v3/docs/channels/list
data_channel_request( part = NULL, categoryId = NULL, forUsername = NULL, hl = NULL, id = NULL, managedByMe = NULL, maxResults = 5, mine = NULL, onBehalfOfContentOwner = NULL, pageToken = NULL, token = getOption("YouTube_Token") )
data_channel_request( part = NULL, categoryId = NULL, forUsername = NULL, hl = NULL, id = NULL, managedByMe = NULL, maxResults = 5, mine = NULL, onBehalfOfContentOwner = NULL, pageToken = NULL, token = getOption("YouTube_Token") )
part |
Required. String. |
categoryId |
String. |
forUsername |
String. |
hl |
String. |
id |
String. |
managedByMe |
String. |
maxResults |
Integer. |
mine |
String. |
onBehalfOfContentOwner |
String. |
pageToken |
String. |
token |
Required. |
data.frame
## Not run: data_channel_request(part = "contentDetails", mine = "true") ## End(Not run)
## Not run: data_channel_request(part = "contentDetails", mine = "true") ## End(Not run)
This is a function to make API calls to the YouTube Data API for playlist specific data.
While it can be called directly, it is primarily intended to help get lists of videos within
a playlist. For more in-depth use of the Data API, please refer to tuber
. For
more details on the following arguments, please refer to
https://developers.google.com/youtube/v3/docs/playlists/list
data_playlist_request( part = NULL, channelId = NULL, hl = NULL, id = NULL, maxResults = 5, mine = NULL, onBehalfOfContentOwner = NULL, onBehalfOfContentOwnerChannel = NULL, pageToken = NULL, token = getOption("YouTube_Token") )
data_playlist_request( part = NULL, channelId = NULL, hl = NULL, id = NULL, maxResults = 5, mine = NULL, onBehalfOfContentOwner = NULL, onBehalfOfContentOwnerChannel = NULL, pageToken = NULL, token = getOption("YouTube_Token") )
part |
Required. String. |
channelId |
String. |
hl |
String. |
id |
String. |
maxResults |
Integer. |
mine |
String |
onBehalfOfContentOwner |
String. |
onBehalfOfContentOwnerChannel |
String. |
pageToken |
String. |
token |
Required. |
data.frame
## Not run: data_playlist_request(part = "contentDetails", id = "PLA2387dsgkhfs9832hjkhuihsASDF", mine = "true") ## End(Not run)
## Not run: data_playlist_request(part = "contentDetails", id = "PLA2387dsgkhfs9832hjkhuihsASDF", mine = "true") ## End(Not run)
This is a function to make API calls to the YouTube Data API for playlist item data.
While it can be called directly, it is primarily intended to help get lists of videos within
a playlist. For more in-depth use of the Data API, please refer to tuber
. For
more details on the following arguments, please refer to
https://developers.google.com/youtube/v3/docs/playlistItems/list
data_playlistItem_request( part = NULL, id = NULL, maxResults = 5, onBehalfOfContentOwner = NULL, pageToken = NULL, playlistId = NULL, videoId = NULL, token = getOption("YouTube_Token") )
data_playlistItem_request( part = NULL, id = NULL, maxResults = 5, onBehalfOfContentOwner = NULL, pageToken = NULL, playlistId = NULL, videoId = NULL, token = getOption("YouTube_Token") )
part |
Required. String. |
id |
String. |
maxResults |
Integer. |
onBehalfOfContentOwner |
String. |
pageToken |
String. |
playlistId |
String. |
videoId |
String. |
token |
Required. |
data.frame
## Not run: data_playlistItem_request(part = "contentDetails", id = "PLA2387dsgkhfs9832hjkhuihsASDF", mine = "true") ## End(Not run)
## Not run: data_playlistItem_request(part = "contentDetails", id = "PLA2387dsgkhfs9832hjkhuihsASDF", mine = "true") ## End(Not run)
This is a function to make API calls to the YouTube Data API for video data.
While it can be called directly, it is primarily inteded to help get metadata about videos
such as title or description. For more in-depth use of the Data API, please refer to
tuber
. For more details on the following arguments, please refer to
https://developers.google.com/youtube/v3/docs/videos/list
data_video_request( part = NULL, chart = NULL, hl = NULL, id = NULL, locale = NULL, maxHeight = NULL, maxResults = NULL, maxWidth = NULL, myRating = NULL, onBehalfOfContentOwner = NULL, pageToken = NULL, regionCode = NULL, videoCategoryId = NULL, token = getOption("YouTube_Token") )
data_video_request( part = NULL, chart = NULL, hl = NULL, id = NULL, locale = NULL, maxHeight = NULL, maxResults = NULL, maxWidth = NULL, myRating = NULL, onBehalfOfContentOwner = NULL, pageToken = NULL, regionCode = NULL, videoCategoryId = NULL, token = getOption("YouTube_Token") )
part |
Required. String |
chart |
String. |
hl |
String. |
id |
String. |
locale |
String. |
maxHeight |
Integer. |
maxResults |
Integer. |
maxWidth |
Integer. |
myRating |
String. |
onBehalfOfContentOwner |
String. |
pageToken |
String. |
regionCode |
String. |
videoCategoryId |
String. |
token |
Required. |
data.frame()
## Not run: data_video_request(part = "contentDetails", id = "dQw4w9WgXcQ") ## End(Not run)
## Not run: data_video_request(part = "contentDetails", id = "dQw4w9WgXcQ") ## End(Not run)
Returns top countries by views
playlist_countries(playlistId = NULL, ...)
playlist_countries(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_countries(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_countries(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns age and gender demographics
playlist_demographics(playlistId = NULL, ...)
playlist_demographics(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_demographics(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_demographics(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns top devices by views
playlist_devices(playlistId = NULL, ...)
playlist_devices(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_devices(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_devices(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Return playlist data split by live & on demand.
playlist_live_onDemand(playlistId = NULL, ...)
playlist_live_onDemand(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_live_onDemand(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_live_onDemand(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Playlist Metadata
playlist_metadata(playlistId = NULL, ...)
playlist_metadata(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube Video. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_metadata(playlistId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: playlist_metadata(playlistId = "dQw4w9WgXcQ") ## End(Not run)
Returns the type of page or application where video playbacks occurred.
playlist_playback_location(playlistId = NULL, ...)
playlist_playback_location(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
For more information, refer to https://developers.google.com/youtube/analytics/dimensions#Playback_Location_Dimensions
data.frame
## Not run: playlist_playback_location(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_playback_location(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
#' @description Returns high level video stats.
playlist_stats(playlistId = NULL, ...)
playlist_stats(playlistId = NULL, ...)
playlistId |
Required. Strings. Id of YouTube Playlist |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_stats(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_stats(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
#' @description Returns the subscription status of playlist views.
playlist_subscription_status(playlistId = NULL, ...)
playlist_subscription_status(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube Playlist |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_subscription_status(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_subscription_status(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns top videos by views.
playlist_top_videos(playlistId = NULL, ...)
playlist_top_videos(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_top_videos(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_top_videos(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns top traffic sources by views. Check out https://developers.google.com/youtube/analytics/dimensions#Traffic_Source_Dimensions for more information.
playlist_traffic_details(playlistId = NULL, trafficType = "EXT_URL", ...)
playlist_traffic_details(playlistId = NULL, trafficType = "EXT_URL", ...)
playlistId |
Required. String. Id of YouTube playlist. |
trafficType |
Required. String. Type of traffic source. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_traffic_sources(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_traffic_sources(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns top traffic sources by views
playlist_traffic_sources(playlistId = NULL, ...)
playlist_traffic_sources(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_traffic_sources(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_traffic_sources(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns all videos in playlist
playlist_videos(playlistId = NULL, ...)
playlist_videos(playlistId = NULL, ...)
playlistId |
Required. String. Id of YouTube playlist. |
... |
Addt. arguments passed to |
data.frame
## Not run: playlist_videos(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
## Not run: playlist_videos(playlistId = "PL2MI040U_GXq1L5JUxNOulWCyXn-7QyZK") ## End(Not run)
Returns audience retention percentages for a video. By default this function will return audience retention rates for organic views.
video_audience_retention(videoId = NULL, audienceType = "ORGANIC", ...)
video_audience_retention(videoId = NULL, audienceType = "ORGANIC", ...)
videoId |
Required. String. Id of YouTube video. |
audienceType |
Required. String. Supported values are |
... |
Addt. arguments passed to |
data.frame
## Not run: video_audience_retention(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_audience_retention(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns top cities by views. Data is only available after January 1, 2022.
video_cities(videoId = NULL, ...)
video_cities(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_cities(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_cities(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns top countries by views
video_countries(videoId = NULL, ...)
video_countries(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_countries(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_countries(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns age and gender demographics
video_demographics(videoId = NULL, ...)
video_demographics(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_demographics(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_demographics(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns top devices by views
video_devices(videoId = NULL, ...)
video_devices(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_devices(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_devices(videoId = "dQw4w9WgXcQ") ## End(Not run)
Return video data split by live & on demand.
video_live_onDemand(videoId = NULL, ...)
video_live_onDemand(videoId = NULL, ...)
videoId |
Required.String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_live_onDemand(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_live_onDemand(videoId = "dQw4w9WgXcQ") ## End(Not run)
Video Metadata
video_metadata(videoId = NULL, ...)
video_metadata(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube Video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_metadata(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_metadata(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns the type of page or application where video playbacks occurred.
video_playback_location(videoId = NULL, ...)
video_playback_location(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
For more information, refer to https://developers.google.com/youtube/analytics/dimensions#Playback_Location_Dimensions
data.frame
## Not run: video_playback_location(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_playback_location(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns top sharing services by views
video_sharing_services(videoId = NULL, ...)
video_sharing_services(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_sharing_services(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_sharing_services(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns high level video stats.
video_stats(videoId = NULL, ...)
video_stats(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_stats(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_stats(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns the subscription status of video views.
video_subscription_status(videoId = NULL, ...)
video_subscription_status(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_subscription_status(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_subscription_status(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns video views by day or month.
video_time_period( videoId = NULL, period = "day", endDate = as.character(format(Sys.Date(), "%Y-%m-01")), ... )
video_time_period( videoId = NULL, period = "day", endDate = as.character(format(Sys.Date(), "%Y-%m-01")), ... )
videoId |
Required. String. Id of YouTube video. |
period |
Required. Time period to breakdown data by. Supported values are
|
endDate |
Required. String. Data returned up until the last day specified,
so for monthly period the end date must end with a day of |
... |
Addt. arguments passed to |
data.frame
## Not run: video_time_period(videoId = "dQw4w9WgXcQ", period = "month") ## End(Not run)
## Not run: video_time_period(videoId = "dQw4w9WgXcQ", period = "month") ## End(Not run)
Returns traffic details by views. Check out https://developers.google.com/youtube/analytics/dimensions#Traffic_Source_Dimensions for more information.
video_traffic_details(videoId = NULL, trafficType = "EXT_URL", ...)
video_traffic_details(videoId = NULL, trafficType = "EXT_URL", ...)
videoId |
Required. String. Id of YouTube video. |
trafficType |
Required. String. Type of traffic source. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_traffic_sources(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_traffic_sources(videoId = "dQw4w9WgXcQ") ## End(Not run)
Returns top traffic sources by views
video_traffic_sources(videoId = NULL, ...)
video_traffic_sources(videoId = NULL, ...)
videoId |
Required. String. Id of YouTube video. |
... |
Addt. arguments passed to |
data.frame
## Not run: video_traffic_sources(videoId = "dQw4w9WgXcQ") ## End(Not run)
## Not run: video_traffic_sources(videoId = "dQw4w9WgXcQ") ## End(Not run)
This creates or grabs a token to authorize API requests
youtube_oauth( clientId = NULL, clientSecret = NULL, tokenFile = ".httr-oauth", useOOB = FALSE, setEnvVar = FALSE, scopes = c("https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/yt-analytics.readonly"), reAuthOnFail = FALSE )
youtube_oauth( clientId = NULL, clientSecret = NULL, tokenFile = ".httr-oauth", useOOB = FALSE, setEnvVar = FALSE, scopes = c("https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/yt-analytics.readonly"), reAuthOnFail = FALSE )
clientId |
Required. Client Id obtained from console.cloud.google.com. |
clientSecret |
Required. Client Secret obtained from console.cloud.google.com |
tokenFile |
The name of the token httr-oauth file to read the token from. If the file does not exist then one will be created with the provided name. |
useOOB |
If |
setEnvVar |
If |
scopes |
Scopes that must be passed when authenticating. See https://developers.google.com/youtube/analytics/reference for more information. |
reAuthOnFail |
If |
token environment
## Not run: youtube_oauth("123456789asdalksdjfhaslkdjfb.apps.googleusercontent.com", "MasdfH5320208ladshf790", token = ".httr-oauth-myToken") ## End(Not run)
## Not run: youtube_oauth("123456789asdalksdjfhaslkdjfb.apps.googleusercontent.com", "MasdfH5320208ladshf790", token = ".httr-oauth-myToken") ## End(Not run)