'YouTube Analytics API not returning demographic data for channel owner

I am using YouTube Analytics API with oauth2.0 authorization to get channel owner demographic(ageGroup and gender).

It does not return any values for the ageGroup and gender. The login(authentication) part works and GAPI loads perfectly as well, but, no values are returned (even though channel analytics show agegroup and gender).

Surprisingly, when I use the basic dimensions (views, likes, comments etc.), it returns the values properly.

Here is how the response look like:

screenshot

This is the code:

function execute() {       
      return gapi.client.youtubeAnalytics.reports.query({         
           "ids": "channel==MINE",         
           "startDate": "2019-01-01",         
           "endDate": "2022-03-27",         
           "metrics": "viewerPercentage",         
           "dimensions": "ageGroup,gender",           
           "filters": "subscribedStatus==SUBSCRIBED",         
           "sort": "ageGroup,gender"       
       })           
           .then(function(response) {                                    
                 console.log("Response", response);                 
            },                 
      function(err) { console.error("Execute error", err); });     
}


Solution 1:[1]

That's because not enough data:

Understand limited data in YouTube Analytics

We want to give creators useful data to make informed decisions about their channel, but some data may be limited in YouTube Analytics.

Note: If your video or channel doesn’t have enough traffic during a selected time period, you may not see your data. If you've selected a specific filter, such as geography or gender, you may also not see data

If you want to see more, try extending the time period, or removing filters and breakdowns. Changing these settings may increase the amount of data in the full report.

Types of limited data The following info may be limited:

Demographics data
Audience data
Geography data
Search terms and URLs

source: https://support.google.com/youtube/answer/9101241?hl=en

related post: YouTube Analytics API - Demographics Minimum Views Seem to Be Required for Query

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frank