Interface OpenMeasurementTracker


public interface OpenMeasurementTracker

The interface definition which wraps and integrates open-measurement.

Integrate Open-Measurement Guide:

  1. Initialize Open Measurement in Application.onCreate():
     public class MyApplication extends Application {
       @Override
       public void onCreate() {
         super.onCreate();
         OpenMeasurementTracker.initialize(this);
       }
     }
     
  2. Create the OpenMeasurementTracker with your partner info and the BaseVideoView playing ads.
     public class MyActivity extends Activity {
    
       private OpenMeasurementTracker omTracker;
    
       @Override public void onCreate(Bundle savedInstanceState) {
         ...
    
         omTracker = new OpenMeasurementTracker.Factory(
             PARTNER_ID, PARTNER_VERSION, videoView
         ).create();
         omTracker.start();
    
         ...
       }
     }
     
  3. Stop the tracker when the activity is destroyed:
     @Override public void onDestroy() {
       omTracker.stop();
     }
     

When integrated, the tracker will handle creating the ad session, sending tracking events, handling player state, parsing the VAST for verification scripts, etc.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Config class used to configure the open-measurement ad session.
    static final class 
    An error that may be thrown when an issue occurs starting or stopped an open-measurement tracking session.
    static class 
    Factory to create an OpenMeasurementTracker
    static interface 
    Listener interface for OMID tracker events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    Debug flag for logging messages
    static final String
    The log tag used for open measurement debugging
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFriendlyObstruction(android.view.View view, com.iab.omid.library.brightcove.adsession.FriendlyObstructionPurpose purpose, String reason)
    Add friendly obstruction which should then be excluded from all ad session viewability calculations.
    void
    Add a listener for OMID events.
    static void
    initialize(android.content.Context context)
    Initialize the OM SDK.
    void
    Removes a listener from the tracking session.
    void
    Starts the open-measurement tracking session.
    void
    Stops the open-measurement tracking session.
  • Field Details

  • Method Details

    • start

      void start() throws OpenMeasurementTracker.Error
      Starts the open-measurement tracking session.
      Throws:
      OpenMeasurementTracker.Error
    • stop

      void stop() throws OpenMeasurementTracker.Error
      Stops the open-measurement tracking session.
      Throws:
      OpenMeasurementTracker.Error
    • addFriendlyObstruction

      void addFriendlyObstruction(android.view.View view, com.iab.omid.library.brightcove.adsession.FriendlyObstructionPurpose purpose, String reason)
      Add friendly obstruction which should then be excluded from all ad session viewability calculations.
      Parameters:
      view - The view considered to be a friendly obstruction.
      purpose - The FriendlyObstructionPurpose
      reason - A detailed reason explaining the use of the friendly obstruction.
    • addListener

      void addListener(OpenMeasurementTracker.Listener listener)
      Add a listener for OMID events.
      Parameters:
      listener - The listener to be added to the tracking session.
    • removeListener

      void removeListener(OpenMeasurementTracker.Listener listener)
      Removes a listener from the tracking session.
      Parameters:
      listener - The listener to be removed.
    • initialize

      @UiThread static void initialize(android.content.Context context)
      Initialize the OM SDK. This should be done inApplication.onCreate():
       public class MyApplication extends Application {
         @Override
         public void onCreate() {
           super.onCreate();
           OpenMeasurementTracker.initialize(this);
         }
       }
       
      Parameters:
      context - The application context used to initialize the OM SDK.