Integrating MoPub + Vungle SDK v.5 (iOS)

Use this guide to add Vungle iOS SDK into your app, using MoPub as your main advertising mediation layer.

Contents

Before You Begin

Step 1. Set Up Vungle as a Custom Native Network

To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard.

  1. Log into the MoPub dashboard, and navigate to Networks by the main navigation bar.

  2. Click Add a Network...
    image4.png

    and select Custom Native Network at the bottom of the page.
    image2.png

  3. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter we used to interact with the Vungle SDK:

    • If you are using MoPub Rewarded Video for an Ad Unit, add VungleRewardedVideoCustomEvent under the Custom Event Class.

    • If you are using Fullscreen (Interstitial) for an Ad Unit, add VungleInterstitialCustomEvent under the Custom Event Class.

    • Add your Vungle App ID, placement reference ID, and all placement reference IDs in JSON format under the Custom Event Class Data.

    • Set the placement reference ID you want to link to the MoPub Ad Unit for pid.

      Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements functionality. If you create multiple placements, provide all the reference IDs.

    • Make sure to link the reference ID of the placement set to “Rewarded” to the MoPub Ad Unit that is set to Rewarded Video; and link the reference ID of the placement that is NOT set to “Rewarded” to the MoPub Ad Unit set to Fullscreen (Interstitial).
      {
      "appId":"59208865950e6d380100001f", 
      "pid":"PADUNIT55750", 
      "pids":"DEFAULT07430,PADUNIT96220,PADUNIT55750,PADUNIT06724,PADUNIT16058,PADUNIT59118"
      }

      image3.png

      Note: The Vungle SDK will cache an ad automatically for the placement you selected to be Auto Cached​ in the Vungle Dashboard. We highly recommend selecting the MoPub Ad Unit shown first or the Ad Unit shown most frequently as the Auto Cached placement.

Step 2. Add Vungle as a Third-Party Ad Network

To add the Vungle iOS SDK into your app using MoPub mediation:

  1. Add all the Vungle-related adapter files (under /AdNetworkSupport/Vungle/ in the MoPub Adapter Repository) to your app’s project and make sure they are included in the project's Build Phases → Compile Sources.
    MPInstanceProvider+Vungle.h
    MPInstanceProvider+Vungle.m			
    MPVungleRouter.h
    MPVungleRouter.m	
    VungleInstanceMediationSettings.h
    VungleInstanceMediationSettings.m
    VungleInterstitialCustomEvent.h
    VungleInterstitialCustomEvent.m
    VungleRewardedVideoCustomEvent.h
    VungleRewardedVideoCustomEvent.m
  2. Download the Vungle iOS SDK and copy the VungleSDK.framework folder into  /AdNetworkSupport/Vungle/SDK/.

    • Make sure the project's Build Settings → Framework Search Path includes the framework. For example:
      $(PROJECT_DIR)/AdNetworkSupport/Vungle/SDK/VungleSDK.framework
    • Make sure the framework is included in the project's Build Phases → Link Binary With Libraries.

  3. Follow the instructions in the “Add Other Required Frameworks“ section of “Get Started with Vungle - iOS SDK“ to add the necessary frameworks.

  4. Follow the instructions in the “Add the “-ObjC” Linker Flag“ section of “Get Started with Vungle - iOS SDK“ to add the linker flag.

  5. Follow the instructions in the “Remove the iOS Status Bar“ section of “Get Started with Vungle - iOS SDK“ to remove the status bar.

  6. Call the MPInterstitialAdController’s showFromViewController method (or, for rewarded ads, call the  MPRewardedVideo's presentRewardedVideoAdForAdUnitID method) when you want to present a Vungle video ad! (No need to call the Vungle iOS SDK methods directly. The MoPub SDK will do it.)

 

 

Have more questions? Submit a request

Comments