MPInterstitialCustomEvent

@interface MPInterstitialCustomEvent : NSObject

The MoPub iOS SDK mediates third-party ad networks using custom events. The custom events are responsible for instantiating and manipulating objects in the third-party SDK, and translating and communicating events from those objects back to the MoPub SDK by notifying a delegate.

MPInterstitialCustomEvent is a base class for custom events that support fullscreen interstitial ads. By implementing subclasses of MPInterstitialCustomEvent, you can enable the MoPub SDK to natively support a wide variety of third-party ad networks.

At runtime, the MoPub SDK will find and instantiate an MPInterstitialCustomEvent subclass as needed and invoke its -requestInterstitialWithCustomEventInfo: method.

Public Properties

Communicating with the MoPub SDK

/delegate

  • Description: The MPInterstitialCustomEventDelegate to send messages to as events occur. The delegate object defines several methods that you should call in order to inform both MoPub and your MPInterstitialAdController‘s delegate of the progress of your custom event.

  • Declaration:

    @property (readwrite, nonatomic) id<MPInterstitialCustomEventDelegate> delegate;
    
  • Parameters: None.

/localExtras

  • Description: An optional dictionary containing extra local data.

  • Declaration:

    @property (readwrite, copy, nonatomic) NSDictionary *localExtras;
    
  • Parameters: None.

Public Methods

Requesting and Displaying an Interstitial Ad

-/requestInterstitialWithCustomEventInfo:

  • Description: Called when the MoPub SDK requires a new interstitial ad. When the MoPub SDK receives a response indicating it should load a custom event, it will send this message to your custom event class. Your implementation of this method should load an interstitial ad from a third-party ad network. It must also notify the MPInterstitialCustomEventDelegate of certain lifecycle events.

  • Declaration:

    - (void)requestInterstitialWithCustomEventInfo:(NSDictionary *)info;
    
  • Parameters:

    • info: A dictionary containing additional custom data associated with a given custom event request. This data is configurable on the MoPub website, and may be used to pass dynamic information, such as publisher IDs.

-/showInterstitialFromRootViewController:

  • Description: Called when the interstitial should be displayed. This message is sent sometime after an interstitial has been successfully loaded, as a result of your code calling -MPInterstitialAdController showFromViewController:. Your implementation of this method should present the interstitial ad from the specified view controller. If you decide to opt out of automatic impression tracking, you should place your manual calls to -trackImpression in this method to ensure correct metrics.

  • Declaration:

    - (void)showInterstitialFromRootViewController:
        (UIViewController *)rootViewController;
    
  • Parameters:

    • rootViewController: The controller to use to present the interstitial modally.

Impression and Click Tracking

-/enableAutomaticImpressionAndClickTracking

  • Description: Override to opt out of automatic impression and click tracking. By default, the MPInterstitialCustomEventDelegate will automatically record impressions and clicks in response to the appropriate callbacks. You may override this behavior by implementing this method to return NO. Important: If you do this, you are responsible for calling the -trackImpression and -trackClick methods on the custom event delegate. Additionally, you should make sure that these methods are only called once per ad.

  • Declaration:

    - (BOOL)enableAutomaticImpressionAndClickTracking;
    
  • Parameters: None.

Last updated February 11, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)