[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Wed Sep 12 2018

Integrating Bitmovin Analytics with VideoJS

Integrating the Analytics CollectorLink Icon

Installation

Please add the following <script></script> tag into your <head>:

1<script type="text/javascript"
2src="//bitmovin-a.akamaihd.net/bitmovin-analytics/stable/1/bi
3tmovinanalytics.min.js"></script>

Minimal Configuration

Setting up Bitmovin Analytics is very simple. A minimal configuration can be set up in 5 lines of code.

1var bitanalyticsConfig = {
2 key: "INSERT-ANALYTICS-KEY-HERE"
3};
4var analytics = bitmovin.analytics(bitanalyticsConfig);
5
6var player = videojs('my-video', options);
7
8// Instrument the Player with Analytics
9analytics.register(player);

It is important to call analytics.register as soon as possible after the videojs() initialization call!

Optional Fields and Important Fields

While the minimum configuration is the bare minimum to get started, the following fields are strongly recommended to be set:

  • videoId
  • cdnProvider

VideoId:

Supplying a videoId to Analytics makes it easy to distinguish between played contents so it is highly recommended to set this setting to something that corresponds with your System (usually a CMS Id or some string that identifies the Video for you)

Setting the videoId is simple.

1var bitanalyticsConfig = {
2 key: "INSERT-ANALYTICS-KEY-HERE",
3 videoId: "YOUR-VIDEO-ID"
4}

CDN Provider:

If you are using multiple CDNs or plan to test with different CDNs in the future it's very helpful to set the cdnProvider parameter to be able to compare performance between the CDNs. You can specify any string, but we have built in some constants that are available on bitmovin.analytics.CdnProviders.

  • BITMOVIN
  • AKAMAI
  • FASTLY
  • MAXCDN
  • CLOUDFRONT
  • CHINACACHE
  • BITGRAVITY

Custom DataLink Icon

It is possible to supply custom data to Bitmovin Analytics. We support 5 fields for custom data as well as experimentName which can be used to A/B Test your setup.

CustomData fields include:

  • customData1
  • customData2
  • customData3
  • customData4
  • customData5 A full example VideoJS instrumented by Bitmovin Analytics can be found on our GitHub example page.

Verifying your SetupLink Icon

To test if your setup is working you can just go to the Analytics Dashboard to see if your sessions are being recorded. If you don't see any sessions, please check if you are using the correct analytics key, and your white-listed all domains correctly in your analytics license.

Next Step: Getting started with the Analytics API

Previous Step: Getting Started with Bitmovin Analytics

Give us feedback