Contact Support | System Status
Page Contents

    Using Custom Metrics and Events

    In this topic you will learn how to attach custom events and metrics to view events.

    The Campaign player plugin includes a client-side API for attaching custom events and metrics to view events. The following example outlines how to track custom events and metrics.

    1. Obtain a reference to the Brightcove Player. This example assumes that an id of myPlayerID has been added to the player embed code.
      var player = videojs(‘myPlayerID’);
    2. Listen for the Audience ready event, audience:ready.
      player.on(‘audience:ready’, function() {
        // player.audience is now available for use
    3. To track a string value, call player.audience.track(‘event[1-3]’, ‘value’). To track a numeric value, call player.audience.track(‘metric[1-3]’, value). The return value is a boolean indicating whether or not the event was sent successfully.
      // Store the string value “foo” in the slot event1
      player.audience.track(‘event1’, ‘foo’);
      // Store the string value “bar” in the slot event2
      player.audience.track(‘event2’, ‘bar’);
      // Store the decimal value 15.08 in slot metric1
      player.audience.track(‘metric1’, 15.08);
      // Replace the value in slot metric1 with the number 10,
      // and validate that the call was sent successfully
      var result = player.audience.track(‘metric1’, 10);
      if (result) {
         console.log(‘metric sent successfully’);

    Synchronization with marketing automation platforms

    Custom events/metrics stored on a view event will sync for Marketo REST and Eloqua if the fields are defined on the custom activity or CDO. Campaign will also sync custom events/metrics to HubSpot if they're defined and to Salesforce if the integration is using a Mapping Type of Advanced and the events/metrics are mapped to something.

    Marketo REST

    For Marketo REST integrations, publishers should verify that the Brightcove Video View custom activity in Marketo has the custom event and metric fields. Custom activities are located under Admin > Database Management.

    edit custom activity

    If the fields are not in the Brightcove Video view object:

    1. Update the Brightcove Video View custom activity to add the fields, or
    2. Contact Marketo Support and ask them to add the fields.
    3. After the fields have been added, return to Campaign and press the Complete Update button so Campaign can access the newly added fields.

    Oracle Eloqua

    For Eloqua integrations, publishers should verify that the BrightcoveVideoView custom object has the custom event and metric fields.

    edit custom activity

    If the fields do not exist, the fields need to be added to the BrightcoveVideoView object by either:

    1. Reconnecting your Eloqua account, or
    2. Using the data mapping upgrade button.


    For Salesforce, your Campaign connection should be using a Mapping Type of Advanced. The Event and Metric fields can be mapped to Salesforce objects.

    edit custom activity


    • The limit on string length for event slot values is 250 characters.
    • If multiple values are sent to the same event or metric slot during a single viewing session, the existing value in the slot is replaced with the new value. In the following example, the final value stored in event1 is “click3”.
      player.audience.track(‘event1’, ‘click1’);
      player.audience.track(‘event1’, ‘click2’);
      player.audience.track(‘event1’, ‘click3’);
    • If a view event for the session does not exist yet then one will be created.
    • If the result of track() is false indicating that the event failed to send, you can enable the verbose option on the Campaign plugin to see console logging with a specific reason why.

    Viewing events and metrics

    Custom events and metrics will appear in the Campaign UI. In the left navigation, click All Recent Activity. If any custom events or metrics have been recorded, the Show Interaction Events link will be enabled. Click the link to display the event/metric data.

    viewing metrics

    Enabling verbose logging

    Verbose logging can be enabled by adding bcverbose=1 to the URL of the page with the player or by configuring the Campaign plugin with the "verbose": true option:

    configure plugin

    Page last updated on 14 Jul 2021