Pull YouTube Metrics to a Google Sheet with YT Metrics Add-on

Published: Nov 17, 2020
5 min read
Last updated: Dec 18, 2020

YouTube is a social media that's ever-growing. Many creators do vlogging as a full-time profession. For growing a YouTube channel, analysing various metrics is important. Based on the analytical data, you can make informed decisions on what type of content makes your audience engage more, who your target audience is and much more.

To make the visualisation of the statistical metrics easy, I have built YT Metrics, a Google Sheets add-on. YT Metrics accesses data from your Google/YouTube Account, pulls relevant metrics from YouTube Analytics API and writes it in a Google Sheet.

How to Install

All you need is a Google Sheet to get started. You can install the add-on using this link - YT Metrics. Click 'Install', It will ask for certain permissions within your Google account. Select your Google account and authorise access to YT Metrics.

How your Google data is accessed and used  by YT Metrics

Upon successful installation, YT Metrics gains read-only access to YouTube analytics reports for your YouTube content. It gets write access to your Google Sheets to write the fetched analytics data to the Google Sheet. All permissions required by YT Metrics are explained below. You can know more about how SyncWithTech add-ons handle user data on our privacy policy page.

View monetary and non-monetary YouTube Analytics reports for your YouTube content

YT Metrics fetches the needed read-only analytics data be it monetary or non-monetary metrics from your YouTube account using YouTube Analytics API. After fetching, it writes the data to a Google Sheet.

View your YouTube account

To fetch the list of channels you have access to so that the metrics can be fetched for the appropriate channel.

See, edit, create and delete your spreadsheets in Google Drive

To update the Google Sheet with the data fetched from various YouTube APIs. YT Metrics doesn't delete or create any spreadsheet on its own. It only operates in the sheet you use it.

Connect to an external service

To obtain the user's license detail the add-on has to communicate with the application's backend server.

Display and run third-party web content in prompts and sidebars inside Google applications

The combination of parameters from users to fetch the YouTube analytics data is obtained from a sidebar in a Google Sheet.

After installing, in a Google Sheet, select Add-ons → YT Metrics → Create Report to get started. A sidebar will open like the image shown below. Keep in mind that you have to own the channel/have a manager role or you must be a YouTube content partner to use this add-on to fetch data. It'll contain a dropdown to select the channel (or an optional textbox to input channel IDs if you're a YouTube content partner) for which you want to export metrics and various reports.

Types of metrics & reports you can pull with YT Metrics

You can export all video reports and relevant metrics from channel and content owner reports YouTube Analytics API supports. Examples of what you can fetch are given below.

  • Audience retention details like average view duration, average view percentage, etc.
  • Basic user activity statistics like subscribers gained, subscribers lost, annotation clicks, card clicks, etc.
  • Revenue metrics like ad impressions, CPM, estimated revenue, etc.
  • Traffic source details.
  • Device type and operating system info.
  • Video share details.
  • Top videos from a channel.

How to use YT Metrics to fetch YouTube analytics data

In the sidebar you see after selecting 'Create Report' from the add-on menu, you need to fill in all the required fields to successfully export a report. Different fields you will see in the sidebar are explained below.

Channel

The channel for which you are fetching data. If the Google account you use with the Google Sheet is not linked with a YouTube channel, this dropdown will be empty. You can add a channel by clicking on 'Add a channel' link and add a channel from a brand account you own or for which you are a manager.

If you are a YouTube content partner, you can add your content owner id to YT metrics and manually put channel IDs in a text box to fetch the reports for any channel you manage.

Report

In total, 30 reports are available for you to pick. You can know more about the reports on YouTube Analytics docs. Each report can support some ways to aggregate the data which you will see as checkboxes after selecting a report. You can check the data points you want to see in the sheet. These data points are called dimensions.

Metrics

This is a required field. You can check what every metric means in detail on metrics doc page.  These are the individual measurement of the reports. You can pick one or more metrics from this dropdown. You will see the list of metrics supported for the report you picked.

To export revenue metrics, you need to add your content owner id.

Date range

This is the two dates between which you want to pull the analytics data. After selecting a date, you need to pick another date these two dates will become the date range of your data.

Filters

If the report you picked supports filtering, you can make use of this field. At first, it'll be a group of checkboxes. As you check those, new dropdown or text box will appear which you will be required to fill.

Sort

This field helps you sort the data fetched. Only some reports support this. You need to pick a sort value when it is needed.

Max Results

Like sort, some reports require it. It is an integer value.

Offsets

You may want to add your own custom headers to the row or column of the sheet. For that these fields come in handy. Just fill it with integers, YT Metrics will leave n number of rows & columns empty before updating your sheet.

After you fill the fields required by the report, click on 'Export Report'. Fix the errors if reported. Data will be pulled from the YouTube Analytics API and the sheet will be updated with the metrics.

You may like: How to fetch public stats of YouTube videos & channels.

Configuration

To pull revenue metrics, you have to add your 'Content Owner ID' to YT Metrics. If you are a YouTube content partner and to pull metrics for any channel you manage YT Metrics needs your 'Content Owner ID'.

You can select Configuration from the add-on menu to add the Content Owner ID.

How to get your content owner ID

Go to content owner list API reference page, in the right side pane, click on 'Execute'. Authenticate the request with the relevant Google/brand account and you will be able to see your content owner id in the response. Copy the "id" field and paste it in the YT Metrics configuration dialog and save. You can refer to the image below.

How to add channel IDs manually as a content partner

After adding the content owner id, you can check the box at the top of the Create Report' sidebar and add channel IDs manually. You can add more than one channel ID by separating it with commas.

Possible Errors

You will get 'Bad query' notification in the bottom right corner if one or more of the text field values are invalid. If your access to the channel is revoked, you will get 'Unauthorised request' error. You will get Forbidden request error if the content owner id is invalid. Sometimes API returns no data simply because, there is none available.