MPInterstitialCustomEventDelegate /1.11.1.0

@protocol MPInterstitialCustomEventDelegate <NSObject>

Instances of your custom subclass of MPInterstitialCustomEvent will have an MPInterstitialCustomEventDelegate delegate. You use this delegate to communicate events ad events back to the MoPub SDK.

When mediating a third-party ad network, it is important to call as many of these methods as accurately as possible. Not all ad networks support all these events, and some support different events. It is your responsibility to find an appropriate mapping between the ad network’s events and the callbacks defined on MPInterstitialCustomEventDelegate.

Public Methods

-/location /+1.11.1.0-5.12.0

  • Description: The user’s current location. You can use this to inform third-party ad networks of the user’s location. This method provides the location that was passed into the parent MPInterstitialAdController. The MoPub SDK does not automatically request the user’s location. It is your responsibility to pass the location into MPInterstitialAdController.

  • Declaration:

    - (CLLocation *)location;
    
  • Parameters: None.

Interstitial Ad Event Callbacks - Fetching Ads

-/interstitialCustomEvent:didLoadAd: /+1.11.1.0

  • Description: Call this method immediately after an ad loads successfully. Important: Your custom event subclass must call this method when it successfully loads an ad. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall.

  • Declaration:

    - (void)interstitialCustomEvent:(MPInterstitialCustomEvent *)customEvent
                        didLoadAd:(id)ad;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

    • ad: Optional. An object that represents the ad that was retrieved. The MoPub SDK does not do anything with this optional parameter.

-/interstitialCustomEvent:didFailToLoadAdWithError: /+1.11.1.0

  • Description: Call this method immediately after an ad fails to load. Important: Your custom event subclass must call this method when it fails to load an ad. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall.

  • Declaration:

    - (void)interstitialCustomEvent:(MPInterstitialCustomEvent *)customEvent
         didFailToLoadAdWithError:(NSError *)error;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

    • error: Optional. You may pass an error describing the failure.

-/interstitialCustomEventDidExpire: /+1.11.1.0

  • Description: Call this method if a previously loaded interstitial should no longer be eligible for presentation. Some third-party networks will mark interstitials as expired (indicating they should not be presented) after they have loaded. You can use this method to inform the MoPub SDK that a previously loaded interstitial has expired and that a new interstitial should be obtained.

  • Declaration:

    - (void)interstitialCustomEventDidExpire:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

Interstitial Ad Event Callbacks - Presenting and Dismissing Ads

-/interstitialCustomEventWillAppear: /+1.11.1.0

  • Description: Call this method when an ad is about to appear. Important: Your custom event subclass must call this method when it is about to present the interstitial. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall.

  • Declaration:

    - (void)interstitialCustomEventWillAppear:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

-/interstitialCustomEventDidAppear: /+1.11.1.0

  • Description: Call this method when an ad has finished appearing. Important: Your custom event subclass must call this method when it is finished presenting the interstitial. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall. Note that if it is not possible to know when the interstitial finished appearing, you should call this immediately after calling -interstitialCustomEventWillAppear:.

  • Declaration:

    - (void)interstitialCustomEventDidAppear:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

-/interstitialCustomEventWillDisappear: /+1.11.1.0

  • Description: Call this method when an ad is about to disappear. Important: Your custom event subclass must call this method when it is about to dismiss the interstitial. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall.

  • Declaration:

    - (void)interstitialCustomEventWillDisappear:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

-/interstitialCustomEventDidDisappear: /+1.11.1.0

  • Description: Call this method when an ad has finished disappearing. Important: Your custom event subclass must call this method when it is finished with dismissing the interstitial. Failure to do so will disrupt the mediation waterfall and cause future ad requests to stall. Note that if it is not possible to know when the interstitial finished dismissing, you should call this immediately after calling -interstitialCustomEventDidDisappear:.

  • Declaration:

    - (void)interstitialCustomEventDidDisappear:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

Interstitial Ad Event Callbacks - User Interaction

-/interstitialCustomEventDidReceiveTapEvent: /+1.11.1.0

  • Description: Call this method when the user taps on the interstitial ad. This method is optional. When automatic click and impression tracking is enabled (the default), this method will track a click. The click is guaranteed to only be tracked once per ad. Note that some third-party networks provide a “will leave application” callback instead of or in addition to a “user did click” callback. You should call this method in response to either of those callbacks, because leaving the application is generally an indicator of a user tap.

  • Declaration:

    - (void)interstitialCustomEventDidReceiveTapEvent:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

-/interstitialCustomEventWillLeaveApplication: /+1.11.1.0

  • Description: Call this method when the interstitial ad will cause the user to leave the application. For example, the user may have tapped on a link to visit the App Store or Safari.

  • Declaration:

    - (void)interstitialCustomEventWillLeaveApplication:
      (MPInterstitialCustomEvent *)customEvent;
    
  • Parameters:

    • customEvent: Pass self to allow the MoPub SDK to associate this event with the correct instance of your custom event.

Impression and Click Tracking

-/trackImpression /+1.11.1.0

  • Description: Tracks an impression. Important: Only call this method if you have opted out of automatic click and impression tracking. By default the MoPub SDK automatically tracks impressions. To obtain accurate metrics, it is your responsibility to call trackImpression only once per ad.

  • Declaration:

    - (void)trackImpression;
    
  • Parameters: None.

-/trackClick /+1.11.1.0

  • Description: Tracks a click. Important: Only call this method if you have opted out of automatic click and impression tracking. By default the MoPub SDK automatically tracks clicks. To obtain accurate metrics, it is your responsibility to call trackClick only once per ad.

  • Declaration:

    - (void)trackClick;
    
  • Parameters: None.

Last updated May 06, 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.)