Retrieving YouTube Analytics Data
YouTube Analytics data is organized into various metrics (Viewers, ViewerPercentage, AgeGroup, etc.), which can be queried over various dimensions (Day, DeviceType, etc.). There are many valid combinations of metrics and dimensions. The connector surfaces some of the most commonly used combinations as relational views for ease of use.
Additionally, the connector allows you to query all valid combinations, even those not included in the predefined views. You can use the CreateCustomSchema stored procedure to create a view on a query. Refer to Data Model for how to combine metrics and dimensions in queries and schemas. Below is a guide to getting started with the default views.
Selecting Dimensions and Measures
The dimension and metrics are clearly defined for each table and can be seen in the Data Model: Simply select the metrics and the dimensions you are interested in.
For example, a channel's top videos by most minutes watched in a specific country can be selected like this:
SELECT Video, Views, EstimatedMinutesWatched, AverageViewDuration, AverageViewPercentage FROM TopVideos WHERE Country='AL'
Executing SELECT * Queries
Unlike most database tables, it is not very helpful to select all metrics and dimensions in a given table. The connector thus interprets the SELECT * query to mean a default set of metrics and dimensions are requested. This includes queries that explicitly select all columns. Refer to the individual view's documentation in Data Model to see which fields are the default for each schema.