Sending viewer id - Brightcove player
Requirements
The following requirements are needed for the Viewer ID Tracking:
- Brightcove Player v7.18.0 or newer
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:
-
Even though viewer data is sent to Brightcove analytics automatically, you need to set the user identifier. To do this, use the
setUser()
method. For example:myPlayer.bcAnalytics.client.setUser('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.
-
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.setUser('viewer id'); }); </script>
- When the
setUser()
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 theuser
field in this case, but allvideo_*
events should include it.
Custom web 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.
On your websites that host your player, you can use an authentication gateway or some identity management solution to keep track viewers. Use this viewer id as the viewer identifier to pass to Brightcove analytics.
This user
parameter passed to Brightcove can be used in the next section to retrieve the playback position from the XDR API.