Send viewer id - Brightcove player

Requirements

The following requirements are needed for the Viewer ID Tracking:

First, you need to set the user identifier to store that user's viewing activity.

Brightcove Player

If you are using Brightcove Player, follow these steps:

  1. Even though viewer data is sent to Brightcove analytics automatically, you need to set the user identifier. To do this, use the user() method. For example:

    myPlayer.bcAnalytics.client.user('viewer id');

    On your websites that host Brightcove Player, you can use an authentication gateway or some identity management solution to keep track of viewers. Use this viewer id as the viewer identifier to pass to Brightcove analytics.

  2. It is important to set the viewer id before any source is set on the player. It should be called immediately after initializing the player.

    <video-js
      id="myPlayerID"
      data-account="1752604059001"
      data-player="hyQW6GByl"
      data-embed="default"
      controls=""
      data-video-id="6156696074001"
      data-playlist-id=""
      data-application-id=""
      width="640" height="360"></video-js>
    <script src="https://players.brightcove.net/1752604059001/hyQW6GByl_default/index.min.js"></script>
    
    <script>
      videojs.getPlayer('myPlayerID').ready(function() {
        var myPlayer = this;
    
        // Set the viewer id for Brightcove analytics
        myPlayer.bcAnalytics.client.user('viewer id');
      });
    </script>
  3. When the user() method is used, the value is not hashed and will be sent in the clear with all subsequent beacons.

    Note that the player_init event will not include the user field in this case, but all video_* events should include it.

Custom player

If you are building a custom implementation that does not use Brightcove Player, add the user parameter to your Data Collection API requests. For details, see the Overview: Data Collection API v2 document.

You can use an authentication gateway or an identity management solution to track viewers on the sites that host your player. Use this viewer ID as the viewer identifier to pass to Brightcove analytics.

{% if site.product == 'Brightcove Player' %}

This user parameter passed to Brightcove can be used in the next section to retrieve the playback position from the XDR API.

{% endif %}