As always YouTube APIs doesn’t provide access to a basic feature but here is a workaround:
The following answer is similar to the one I wrote about retrieving Unique viewers
from the Audience
tab.
Go on your Video analytics interface in YouTube Studio.
Open the Web Developer Tools
Network
tab of your web-browser (by using Ctrl + Shift + E on Firefox for instance).
Now select Reach
, pay attention to select one of following:
Because options:
- Since published
- Others depending on the time of video upload
Are maybe unavailable (depends if its a published video or depends on the time of video upload):
Total number of unique viewers is only available for periods of up to
90 days to ensure data quality.
You should see a request to get_screen
, copy it as cURL (by right-clicking).
Pay attention to remove -H 'Accept-Encoding: gzip, deflate, br'
or append | gunzip
from it in order to get the JSON response in a human readable format. Otherwise you would face the following warning:
Warning: Binary output can mess up your terminal. Use “–output -” to tell curl to output it to your terminal anyway, or consider “–output ” to save to a file.
In --data-raw
request argument --data-raw '{"screenConfig":{"entity":{"videoId":"VIDEO_ID"}
pay attention to change the VIDEO_ID
for the one interesting you.
Execute the modified cURL request and your Impressions
and Impressions click-through rate
values are in the JSON response respectively at the keys /cards/0/keyMetricCardData/keyMetricTabs/0/primaryContent/total
and /cards/0/keyMetricCardData/keyMetricTabs/1/primaryContent/total
.