-
public interface OpenMeasurementTracker
The interface definition which wraps and integrates open-measurement.
Integrate Open-Measurement Guide:- Initialize Open Measurement in onCreate:
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); OpenMeasurementTracker.initialize(this); } }
- 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(); ... } }
- 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.
- Initialize Open Measurement in onCreate:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
OpenMeasurementTracker.Listener
Listener interface for OMID tracker events.
public class
OpenMeasurementTracker.Factory
Factory to create an OpenMeasurementTracker
public final class
OpenMeasurementTracker.Config
Config class used to configure the open-measurement ad session.
public final class
OpenMeasurementTracker.Error
An error that may be thrown when an issue occurs starting or stopped an open-measurementtracking session.
-
Method Summary
Modifier and Type Method Description abstract void
start()
Starts the open-measurement tracking session. abstract void
stop()
Stops the open-measurement tracking session. abstract void
addFriendlyObstruction(View view, FriendlyObstructionPurpose purpose, String reason)
Add friendly obstruction which should then be excluded from all ad sessionviewability calculations. abstract void
addListener(OpenMeasurementTracker.Listener listener)
Add a listener for OMID events. abstract void
removeListener(OpenMeasurementTracker.Listener listener)
Removes a listener from the tracking session. static void
initialize(Context context)
Initialize the OM SDK. -
-
Method Detail
-
start
abstract void start()
Starts the open-measurement tracking session.
-
stop
abstract void stop()
Stops the open-measurement tracking session.
-
addFriendlyObstruction
abstract void addFriendlyObstruction(View view, FriendlyObstructionPurpose purpose, String reason)
Add friendly obstruction which should then be excluded from all ad sessionviewability calculations.
- Parameters:
view
- The view considered to be a friendly obstruction.purpose
- The FriendlyObstructionPurposereason
- A detailed reason explaining the use of the friendly obstruction.
-
addListener
abstract void addListener(OpenMeasurementTracker.Listener listener)
Add a listener for OMID events.
- Parameters:
listener
- The listener to be added to the tracking session.
-
removeListener
abstract void removeListener(OpenMeasurementTracker.Listener listener)
Removes a listener from the tracking session.
- Parameters:
listener
- The listener to be removed.
-
initialize
@UiThread() static void initialize(Context context)
Initialize the OM SDK. This should be done inonCreate:
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.
-
-
-
-