IMA Open Measurement with the Native SDKs

In this topic, you will learn how to use the Open Measurement SDK with the IMA plugins for the Brightcove Native SDKs.

Overview

The Brightcove Native SDKs now support using the Open Measurement SDK (OM SDK). The OM SDK, integrated with the Google IMA, allows you to use third-party tools for ad measurement and verification.

The Open Measurement SDK considers all views overlaying the ad media element to be obstructions and reduces ad viewability. Video controls may be considered "friendly" obstructions, but must be registered with the OM SDK to be excluded from ad viewability measurement.

iOS

The Brightcove Native SDK for iOS supports using the OM SDK. For more information about implementing third-party ad measurement, see the Open Measurement in the IMA SDK for iOS document.

UI overlays

If you are using UI control elements which overlay the IMA ad view, then you'll want to register these with the OM SDK. For details, see the Registering Ad Overlays section of the Native SDK for iOS reference.

IMA settings

By default, the Brightcove Native SDK for iOS sets the playerType and playerVersion properties with the following values:

imaSettings.playerType = @"bcov/ios-sdk-player";
imaSettings.playerVersion = [BCOVIMAComponent versionIdentifier];

You may want to override these values. One example would be to get advertising metrics reported directly from Google IMA. To use your own values, set the following on the imaSettings object:

imaSettings.playerType = @"your-player-type";
imaSettings.playerVersion = @"your-player-version"

For code details about using IMA ads with the Native SDK for iOS, see the BasicIMAPlayer sample.

Android

The Brightcove Native SDK for Android supports using the OM SDK. For more information about implementing third-party ad measurement, see the Open Measurement in the IMA SDK for Android document.

UI overlays

If you are using UI control elements which overlay the IMA ad view, then you'll want to register these with the OM SDK. To do this, your code would look something like this:

public class MainActivity extends BrightcovePlayer {
 // ...
 private AdDisplayContainer adDisplayContainer;
 private View adOverlayView;
 // ...

 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // ...
   adOverlayView = findViewById(R.id.ad_overlay);
   setupGoogleIMA();
   // ...
 }

 private void setupGoogleIMA() {
   // Show adOverlayView
   eventEmitter.on(EventType.AD_BREAK_STARTED, (event) ->  {
       adOverlayView.setVisibility(View.VISIBLE);
   });

   // Hide adOverlayView
   eventEmitter.on(EventType.AD_BREAK_COMPLETED, (event) ->  {
       adOverlayView.setVisibility(View.GONE);
   });

   // Create ImaSdkFactory
   final ImaSdkFactory sdkFactory = ImaSdkFactory.getInstance();
   eventEmitter.on(GoogleIMAEventType.ADS_REQUEST_FOR_VIDEO, new EventListener() {
     @Override
     public void processEvent(Event event) {
       // Create a container object to register the friendly obstructions.
       adDisplayContainer = sdkFactory.createAdDisplayContainer();
       adDisplayContainer.registerVideoControlsOverlay(adOverlayView);
       // ...
     }
   });

   eventEmitter.on(EventType.COMPLETED, (event) -> {
     if (adDisplayContainer != null) {
       // Unregister the friendly obstructions
       adDisplayContainer.unregisterAllVideoControlsOverlays();
     }
   });
 }
}

IMA settings

By default, the Brightcove Native SDK for iOS sets the playerType and playerVersion properties with the following values:

imaSdkSettings.setPlayerType("bcov/and-sdk-player");
imaSdkSettings.setPlayerVersion("<replaced with current sdk version>");

You may want to override these values. One example would be to get advertising metrics reported directly from Google IMA. To use your own values, set the following on the imaSdkSettings object:

ImaSdkSettings imaSdkSettings = imaSdkFactory.createImaSdkSettings();
imaSdkSettings.setPlayerType("your-player-type");
imaSdkSettings.setPlayerVersion("your-player-version");
GoogleIMAComponent googleIMAComponent = new GoogleIMAComponent(brightcoveVideoView, eventEmitter, imaSdkSettings);

For code details about using IMA ads with the Native SDK for Android, see the AdRulesIMASampleApp sample.