Connecting to YouTube Analytics
The Sisense YouTube Analytics connector is a standalone connector that allows you to import data from the YouTube Analytics API into the ElastiCube Manager. After you have downloaded and installed the connector, you can connect to the YouTube Analytics API through a connection string you provide Sisense in the ElastiCube Manager. The connection string is used to authenticate users who connect to the YouTube Analytics API. To obtain a connection string, you will need to create a YouTube Analytics app.
Once you have connected to YouTube Analytics, you can import a variety of tables from the YouTube Analytics API.
This page describes how to install the YouTube Analytics connector, how to connect to YouTube Analytics with a connection string, and what tables you can import into the ElastiCube Manager:
- Installing the YouTube Analytics Connector
- Connecting to the YouTube Analytics REST API
- Adding YouTube Analytics Tables to your ElastiCube
- YouTube Analytics Tables
Sisense provides the YouTube Analytics connector as a standalone connector that you can download and add to your list of default Sisense connectors.
To install the YouTube Analytics connector:
- Download the YouTube Analytics installation file.
- Open the installation file and click Install.
- After the installation process is complete, click Close.
- The YouTube Analytics connector is displayed in the ElastiCube Manager under Add Data > Web Services.
To access YouTube Analytics’ REST API from the ElastiCube Manager, you must provide valid Oauth YouTube Analytics credentials through a connection string. These credentials are provided by YouTube Analytics when you create an application.
After you receive your credentials from YouTube Analytics, you can create the connection string and provide Sisense with it to connect to your data.
Creating an App
You can follow the procedure below to register an app and obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret:
- Log in to the Google Developers Console.
- Click Create Project or select an existing project.
- In the API Manager, click Credentials > Create Credentials > OAuth Client Id.
- Click Configure Consent Screen to customize the information displayed to users when they connect.
- If you are connecting from a desktop application, click Other in the Application Type section. If you are connecting from a Web application, click the Web Application option. In the Authorized Redirect URIs box, enter the URL you want to be used as a trusted redirect URL, where the user will return with the token that verifies that they have granted your app access.
- Click Create. The OAuthClientId and OAuthClientSecret are displayed. Save these credentials as they need to be passed to YouTube in the connection string when importing data into the ElastiCube Manager.
- Click OK.
- Select Library > YouTube Analytics API.
- Click Enable.
Sisense uses connection strings to connect to YouTube Analytics and import data into the ElastiCube Manager. Each connection string contains a authentication parameters that the data source uses to verify your identity and what information you can export to Sisense.
After you have obtained the relevant credentials, you can create the connection used to connect to your YouTube account. The YouTube Analytics connection string has the following structure:
The following is an example of a YouTube Analytics connection string:
The example above includes mandatory parameters you can provide in the connection. The required parameters are emphasized in bold.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property
- OAuthClientId: Set this to the Client ID
- OAuthClientSecret: Set this to the Client Secret
- CallbackURL: Set this to http://localhost
- ChannelId: Set this to the YouTube Analytics Channel (Profile). This can be set to the Id of the channel. If not specified, MINE will be used
- ContentOwnerId: Set this to the Id of the content owner
If you have any issues connecting to your data source, see Troubleshooting JDBC Data Connectors.
To add YouTube Analytics data:
- In ElastiCube Manager, click Add Data and then, YouTube Analytics. The Connect to YouTube Analytics window is displayed.
- In Datasource Connection String, enter your connection string.
- Click Connect to Server. YouTube Analytics is displayed in the Select Database list.
- Click OK. Sisense connects to YouTube Analytics and displays a list of tables available for you to import.
- Select the relevant tables and click Add.
The tables are displayed in the ElastiCube Manager.
The Sisense YouTube Analytics connector allows you to import the following tables into the ElastiCube Manager.
|GroupItems||Create, delete, and query Items that compose a Group.|
|Groups||Create, update, delete, and query YouTube Analytics Groups.|
|AdPerformanceReports||Query Ad Performance Reports. Ad Performance Reports provide impression-based metrics for ads that ran during video playbacks. These metrics account for each ad impression, and each video playback can yield multiple impressions.To access AdPerformanceReports, in the WHERE clause, you should specify at least the video, group or a supported combination of uploaderType and claimedStatus.Optionally, the following filters can be specified: country, continent, subcontinentFor dimensions, the 'adType' type is required. Optionally, 'day' dimension can be added. An example query similar to yours would be (notice, AdPerformanceReports view does not have a channel column, instead you have to use a video filter. This is a limitation of the YouTube Analytics API):SELECT AdType, Day, GrossRevenue, StartDate, EndDate FROM AdPerformanceReports WHERE video='vid123' and continent = '019'|
|Demographics||Query YouTubeAnalytics Demographics grouped by age groups and gender.|
|Devices||Query YouTubeAnalytics Devices or Operating System statistics. This table allows you to aggregate viewing statistics based on the manner in which viewers reached your video content. For example, you can identify the number of views that occurred on mobile devices or game consoles.|
|EngagementReports||Query Engagement Reports info. For example, how many times a user shared a video.|
|TimeBasedReports||Query time-based info on views, subscribers, etc. For example, how many new subscribers were gained at a specific time.|
|TopVideos||Query the TopVideos for a channel or the TopPlaylists if you are a content owner. You can also use this view to query playback detail and geographic filters.|
Query TrafficSources. Statistics are based on the manner in which viewers reached your video and playlist content.
|220.127.116.11||June 20, 2017||Support added for retrieving all videos based on channel SELECT * FROM Videos WHERE ChannelId IN (SELECT Id FROM Channels)Many of the tables have been updated to include additional inputs such as OnBehalfOfContentOwner (string) and ForContentOwner (boolean).|
|18.104.22.168||March 16, 2017||The AdPerformanceReports was enhanced to support more combinations of columns to query.|
|22.214.171.124||January 16, 2017||General release|