2

I am using youtube analytics api v1 to retrieve the videos details from youtube. I want to get gender dimension count but couldn't find relevant answer. However, I have succeeded to create a GET url to get other details like elapsedVideoTimeRatio, audienceWatchRatio, relativeRetentionPerformance of a given video id. Please take a look at below URL.

https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel=={ABC_CHANNEL}&start-date=2018-01-04&end-date=2018-04-16&metrics=audienceWatchRatio,relativeRetentionPerformance&dimensions=elapsedVideoTimeRatio&filters=video=={ABCXYZ}&fields=columnHeaders,kind,rows&access_token={ACCESS_TOKEN}

This URL gives me the details of mentioned parameters with no error. But whenever i try to change the metrics or dimensions parameters it gives me error. I want to know how to get analytics data of a particular video with ageGroup, gender dimension.

I am trying to make the GET request using below URL by changing the metrics and dimensions params.

https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel==UCiqK9TkrbgO_i7h-XGExMXQ&start-date=2018-01-04&end-date=2018-04-16&metrics=viewerPercentage&dimensions=ageGroup,gender&filters=video==rUV78kBqdEs;audienceType==ORGANIC&fields=columnHeaders,kind,rows&access_token=ya29.GlufBf1Dc3u6TRsxYFLrSwQS08CcSB0_Dpxt4AbcWNSbMCaEG11jgdwubKxzXA2DsglpmQucmDdDi-k_VxFYljoga8r69-vj5G_i_O3GD0f_T9QHyZcAjG0ssbj5

The above url gives the error response as given below.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "badRequest",
    "message": "The query is not supported. Check the documentation at 
https://developers.google.com/youtube/analytics/v1/available_reports for a list of supported queries."
   }
  ],
  "code": 400,
  "message": "The query is not supported. Check the documentation at 
https://developers.google.com/youtube/analytics/v1/available_reports for a list of supported queries."
 }
}`

Please help.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • how have you tried to change it? please edit your question and show us the request that you are making that fails and the error you are getting – Linda Lawton - DaImTo Apr 16 '18 at 11:18
  • @DalmTo I have edited my code. Please take a look. – Manish Verma Apr 16 '18 at 12:01
  • remove the filters and try again https://developers.google.com/youtube/analytics/v1/channel_reports#demographic-reports – Linda Lawton - DaImTo Apr 16 '18 at 12:24
  • Without filter param its working fine. However, its showing data data for whole channel. But i want the data of single video id rather than getting the data of whole channel. In filters i am passing video id as parameter(i.e video==rUV78kBqdEs). – Manish Verma Apr 16 '18 at 12:32

1 Answers1

1

You are sending filters=video==rUV78kBqdEs;audienceType==ORGANIC as per the documentation you can only send the following filters.

Filters:

  • Use 0 or 1 country, province, continent, subContinent
  • Use 0 or 1 video, group
  • Use 0 or more liveOrOnDemand, subscribedStatus
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Can you please describe in some more detail. what should be the exact value in filter? – Manish Verma Apr 16 '18 at 13:13
  • I have removed `;audienceType==ORGANIC` from filters parameter. The error goes off with these changes. But the result is same as if i remove entire filters parameter from URL, No changes will reflect in response. I am not sure that i am going in right direction or not. – Manish Verma Apr 16 '18 at 13:20
  • remove ;audienceType==ORGANIC you cant use it. there is no other direction to go in. – Linda Lawton - DaImTo Apr 16 '18 at 13:28
  • Please see if following URL if valid `https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel==MINE&start-date=2018-01-04&end-date=2018-04-16&metrics=viewerPercentage&dimensions=ageGroup,gender&filters=video==rUV78kBqdEs&fields=columnHeaders%2Ckind%2Crows&access_token=ya29.GlufBQDbvfooRp2cRRMJLiAidTgdhPPXv4fxC8N9xd2WLOQAp0T2lHFV9XfdcfcNM4zJ-sh42mlxACOVjixWQ0ZNuV-vh1gzMnOk54Jcy1x8HWg5v2_gLtAzW8iM` – Manish Verma Apr 16 '18 at 13:37
  • Invalid Credentials means your access token has expired thats a diffrent issue. – Linda Lawton - DaImTo Apr 16 '18 at 13:39
  • Don't try to hit this in browser, I know the access token is expired in given url. You please take a look and check the URL parameters – Manish Verma Apr 16 '18 at 13:49
  • @ManishVerma this request doesn't return any rows for me: `{ ids: 'channel==MINE', startDate: '2015-11-19', endDate: '2018-01-31', metrics: 'viewerPercentage', dimensions: 'ageGroup', maxResults: 200, filters: 'video==' + videoId }` – sergey.tyan Jun 03 '18 at 23:59
  • please open a new question and not post comments on unrelated issues – Linda Lawton - DaImTo Jun 04 '18 at 05:21