% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_report.R
\name{get_report}
\alias{get_report}
\title{Get Reports}
\usage{
get_report(
  ids,
  metrics,
  start_date = NULL,
  end_date = NULL,
  currency = NULL,
  dimensions = NULL,
  filters = NULL,
  include_historical_channel_data = NULL,
  max_results = NULL,
  sort = NULL,
  start_index = NULL,
  ...
)
}
\arguments{
\item{ids}{String. Channel or content owner identifier.
For channels: \code{"channel==MINE"} (for authenticated user's channel) or
\code{"channel==UCxxxxxxxxxxxxxxx"} (for specific channel ID).
For content owners: \code{"contentOwner==ownerName"}.}

\item{metrics}{String. Comma-separated list of YouTube Analytics metrics,
such as \code{views} or \code{likes,dislikes}.}

\item{start_date}{String. Start date for the report.
Can be in YYYY-MM-DD format or relative date like "last_30_days", "this_month", "yesterday".}

\item{end_date}{String. End date for the report.
Can be in YYYY-MM-DD format or relative date. If NULL and start_date is relative, will be calculated automatically.}

\item{currency}{Optional. String. Default is USD. Specifies what earnings
metrics like \code{earnings, adEarnings, grossRevenue, playbackBasedCpm,
impressionBasedCpm} will be reported in.}

\item{dimensions}{String. Optional. Comma-separated list of YouTube Analytics
dimensions, such as \code{video} or \code{ageGroup,gender}.}

\item{filters}{String. Optional. Dimension value filters. Multiple filters
can be separated by semicolons. For video filtering:
\code{"video==videoId1,videoId2"} (comma-separated video IDs).
For country filtering: \code{"country==US"}.
Combined example: \code{"video==videoId1,videoId2;country==US"}.
Note: When filtering by video IDs, ensure the \code{dimensions} parameter
includes "video".}

\item{include_historical_channel_data}{Boolean. Default is FALSE.
``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.''}

\item{max_results}{Integer. Optional. The maximum number of rows to
include in the response.}

\item{sort}{String. Optional A comma-separated list of dimensions or metrics
that determine the sort order for YouTube}

\item{start_index}{Integer. Optional. ``The 1-based index of the first
entity to retrieve.''}

\item{\dots}{Additional arguments passed to \code{\link[tubern]{tubern_GET}}.}
}
\value{
named list
}
\description{
Retrieves YouTube Analytics reports containing YouTube Analytics data.
}
\section{Troubleshooting 404 Errors}{

If you encounter a 404 "Not Found" error, check the following:
\itemize{
  \item Ensure YouTube Analytics API is enabled in your Google Cloud Console
  project
  \item Verify your authentication token is valid and has the correct scopes
  \item Check that the channel ID (if using specific channel ID) exists and
  you have access to it
  \item Use \code{"channel==MINE"} to access your own authenticated channel's
  data
}
}

\examples{
\dontrun{
# Basic channel report
get_report(ids = "channel==MINE", metrics = "views",
           start_date = "2020-01-01", end_date = "2020-01-31")

# Report with video filtering (requires dimensions = "video")
get_report(ids = "channel==MINE",
           metrics = "views,likes,comments",
           dimensions = "video",
           filters = "video==videoId1,videoId2",
           start_date = "2020-01-01", end_date = "2020-01-31")

# Report with country filtering
get_report(ids = "channel==MINE",
           metrics = "views",
           filters = "country==US",
           start_date = "2020-01-01", end_date = "2020-01-31")
}
}
\references{
\url{https://developers.google.com/youtube/analytics/reference/reports/query}
}
