Get Media Playback Time Spent JSON report data with Analytics 2.0 APIs get-media-playback-time-spent-json-report-data

You can obtain media playback time spent report data using the Analytics 2.0 APIs.

  1. Filter the data using any segment that is built on the UI. To filter by a specific Content ID, create a new segment.

  2. Set the elements -> id in the request body to metrics/playback_time_spent_seconds or metrics/playback_time_spent_minutes depending on whether you want the output in seconds or minutes.

  3. Request a sufficient amount of data.

    • The data range you specify in the report gathers all concurrent viewer data at the time the video session ended.
      You must account for sessions that start on one day and end after midnight which is the next day.

    • Request one more day of data to your intended period in your request, but in your analysis use only the intended data.

A sample request payload for one day of data would look like the following sample. The request is done for 2 consecutive days but in reporting you use only the first day.

Sample Request

{
    "rsid": "[YOUR_RSID]",
    "locale": "en_US",
    "dimension": "variables/daterangeminute",
    "globalFilters": [
        {
            "dateRange": "2021-09-02T00:00/2021-09-03T00:00",
            "type": "dateRange"
        }
    ],
    "metricContainer": {
        "metrics": [
            {
                "columnId": "column1",
                "id": "metrics/playback_time_spent_minutes"
            }
        ]
    },
    "settings": {
        "dimensionSort": "asc",
        "limit": "2000",
        "page": 0
  }
}

Sample Response

{
   "totalPages":1,
   "firstPage":true,
   "lastPage":true,
   "numberOfElements":1440,
   "number":0,
   "totalElements":1440,
   "columns":{
      "dimension":{
         "id":"variables/daterangeminute",
         "type":"time"
      },
      "columnIds":[
         "column1"
      ]
   },
   "rows":[
      {
         "itemId":"12008020000",
         "value":"00:00 2021-09-02",
         "data":[
            123.0
         ]
      },
      {
         "itemId":"12008020001",
         "value":"00:01 2021-09-02",
         "data":[
            143.0
         ]
      },
      {
         "itemId":"12008020002",
         "value":"00:02 2021-09-02",
         "data":[
            167.0
         ]
      },

      ...
      {
         "itemId":"12008022359",
         "value":"23:59 2021-09-02",
         "data":[
            768.0
         ]
      }
   ],
   "summaryData":{
      "filteredTotals":[
         17124.0
      ],
      "totals":[
         18453.0
      ]
   }
}
recommendation-more-help
c8eee520-cef5-4f8c-a38a-d4952cfae4eb