How to recreate dashboard queries via the API
This tutorial shows how to recreate the metrics in the Bitmovin Analytics dashboard via using API queries. If you want to get started with an API integration we recommend exploring the API first via using the API Explorer in the Bitmovin Analytics dashboard. You can follow this tutorial to familiarise yourself with query language and all the inputs necessary.
Audience metrics
For a definition for each of the audience metrics, please read: Analytics Dashboard Metrics Reference.
Plays
javascript
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('IMPRESSION_ID')
.filter('VIDEO_STARTUPTIME', 'GT', 0)
.query()
Play Attempts
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('PLAY_ATTEMPTS')
.query()
Unique Users
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('USER_ID')
.filter('VIDEO_STARTUPTIME', 'GT', 0)
.query()
Concurrent Viewers
metricsBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.metric('max_concurrentviewers')
.query()
Total Page Loads
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('IMPRESSION_ID')
.filter('PLAYER_STARTUPTIME', 'GT', 0)
.query()
Total Hours Watched
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('PLAYED')
.filter('PLAYED', 'GT', 0)
.query()
Average View Time
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('VIEWTIME')
.query()
Quality of Experience
For a definition for each of the quality of service metrics, please follow this link .
Video Startup Time
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.median('VIDEO_STARTUPTIME')
.filter('VIDEO_STARTUPTIME', 'GT', 0)
.query()
DRM Load Time
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.median('DRM_LOAD_TIME')
.filter('DRM_LOAD_TIME', 'GT', 0)
.query()
Seek Time
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.median('SEEKED')
.filter('SEEKED', 'GT', 0)
.query()
Error Percentage
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('ERROR_PERCENTAGE')
.query()
Start Failures
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('VIDEOSTART_FAILED')
.filter('VIDEOSTART_FAILED_REASON', 'NE', 'PAGE_CLOSED')
.filter('VIDEOSTART_FAILED', 'EQ', true)
.query()
Rebuffer Percentage
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('REBUFFER_PERCENTAGE')
.query()
Buffering Time
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('BUFFERED')
.query()
Data Downloaded
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('VIDEO_SEGMENTS_DOWNLOAD_SIZE')
.query()
Bandwidth
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('DOWNLOAD_SPEED')
.query()
Video Bitrate
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('VIDEO_BITRATE')
.filter('VIDEO_BITRATE', 'GT', 0)
.query()
Scale Factor
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('SCALE_FACTOR')
.query()
Server Side Advertising
Ad Count
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('SAMPLES')
.filter('AD_INDEX', 'NE', null)
.query()
Ad Rebuffer Percentage
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('REBUFFER_PERCENTAGE')
.filter('AD', 'EQ', 2)
.query()
Ad Error Percentage
queryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('ERROR_PERCENTAGE')
.filter('AD', 'EQ', 2)
.query()
Ad Top Error Codes
queryBuilder
.between("2024-09-22T16:00:00.000Z", '2024-09-25T16:00:00.000Z')
.licenseKey('….removed....')
.count('IMPRESSION_ID')
.filter('ERROR_CODE', 'NE', null)
.filter('ERROR_CODE', 'NE', 10000)
.filter('AD', 'EQ', 2)
.groupBy('ERROR_CODE')
.groupBy('PLAYER')
.groupBy('PLAYER_VERSION')
.groupBy('PLATFORM')
.orderBy('FUNCTION', "DESC")
.query()
Total Ad Error Sessions
queryBuilder
.between("2024-09-22T16:00:00.000Z", '2024-09-25T16:00:00.000Z')
.licenseKey('….removed....')
.count('IMPRESSION_ID')
.filter('ERROR_CODE', 'NE', null)
.filter('ERROR_CODE', 'NE', 10000)
.filter('AD', 'EQ', 2)
.query()
Ad Failed Beacon URLs
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('AD_IMPRESSION_ID')
.filter('AD_TYPE', 'EQ', 2)
.filter('QUARTILE1_FAILED_BEACON_URL', 'NE', null)
.query()
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('AD_IMPRESSION_ID')
.filter('AD_TYPE', 'EQ', 2)
.filter('MIDPOINT_FAILED_BEACON_URL', 'NE', null)
.query()
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('AD_IMPRESSION_ID')
.filter('AD_TYPE', 'EQ', 2)
.filter('QUARTILE3_FAILED_BEACON_URL', 'NE', null)
.query()
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.count('AD_IMPRESSION_ID')
.filter('AD_TYPE', 'EQ', 2)
.filter('COMPLETED_FAILED_BEACON_URL', 'NE', null)
.query()
Ad Abandonment Rate
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.avg('AD_ABANDONMENT_RATE')
.filter('AD_TYPE', 'EQ', 2)
.query()
First Quartile
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('QUARTILE_1')
.filter('AD_TYPE', 'EQ', 2)
.query()
Midpoint
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('MIDPOINT')
.filter('AD_TYPE', 'EQ', 2)
.query()
Third Quartile
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('QUARTILE_3')
.filter('AD_TYPE', 'EQ', 2)
.query()
Completed
adQueryBuilder
.between('2020-11-01T00:58:28.454Z', '2020-11-04T00:58:28.454Z')
.licenseKey('….removed....')
.sum('COMPLETED')
.filter('AD_TYPE', 'EQ', 2)
.query()
Updated about 2 months ago