Analytics Package

Adding the AnalyticsPackage will enable Bitmovin analytics collector on the player. The package is exported under the packages as AnalyticsPackage.

To enable analytics, we need to add the package and we need to provide analytics config to it as shown bellow.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bitmovin Player Web X Demo</title>
  <script type="text/javascript" src="https://cdn.bitmovin.com/player/web_x/10/bundles/playerx-hls.js"></script>
  <script type="text/javascript" src="https://cdn.bitmovin.com/player/web_x/10/packages/playerx-analytics.package.js"></script>
  <style>
    #player-container {
      width: 95%;
      margin: 20px auto;
    }
    video {
      display: block;
    }
  </style>
</head>
<body>
<div id="player-container"></div>

<script type="text/javascript">
  const player = bitmovin.playerx.Player({
    key: 'YOUR-PLAYER-KEY',
    defaultContainer: document.getElementById("player-container"),
      analytics: {
      key: 'YOUR-ANALYTICS-KEY',
      playerKey: 'YOUR-PLAYER-KEY',
    }
  });

  player.packages.add(bitmovin.playerx['analytics'].default)
  
  const sourceConfig = {
    resources: [{
      url: 'https://cdn.bitmovin.com/content/assets/streams-sample-video/tos/m3u8/index.m3u8',
    }]
  }

  const sourceApi = player.sources.add(sourceConfig);
</script>
</body>
</html>
import {Player} from '@bitmovin/player-web-x/bundles/playerx-hls';
import AnalyticsPackage from '@bitmovin/player-web-x/packages/playerx-analytics.package'

const player = Player({
  key: 'YOUR-PLAYER-KEY',
  defaultContainer: document.getElementById("player-container"),
  analytics: {
  	key: 'YOUR-ANALYTICS-KEY',
    playerKey: 'YOUR-PLAYER-KEY',
  }
});

player.packages.add(AnalyticsPackage)

const firstSourceConfig = {
  resources: [{
    url: 'https://cdn.bitmovin.com/content/assets/streams-sample-video/tos/m3u8/index.m3u8',
  }]
}

const firstSourceApi = player.sources.add(firstSourceConfig);

firstSourceApi.play();

You can check complete analytics config in our API documentation.

The collector at the moment supports the following:

  • Session tracking
  • Startup Times
  • Playing and Pause events
  • Basic info on source being played and the environment

Start using analytics today, visit <https://dashboard.bitmovin.com/analytics/home>.

📘

Additional analytics features will be added as we are extending the player API and its events.