Integrating MoPub + Vungle SDK v.1.0-v.4.1 (iOS)

This guide will run through a quick addition of our iOS SDK into a sample application with MoPub set up as the main advertising mediation layer.  

A few notes before we get started…

  • If you haven't already done so, head over to our dashboard and add your app to your account. You need to do this so that you can get your App ID that you’ll be adding to your app with our SDK. It’s in red on your app’s page.

Now let's get started.  We'll need 2 steps to get up and running: 

Set Up Vungle as a Custom Native Network

To ensure that the MoPub servers recognize the integrated Vungle Adapters, we’ll need to set up Vungle as a Custom Native Network in the MoPub dashboard.  We can do this with a few straight forward steps:

  • While logged into the MoPub dashboard, navigate to 'Networks' in the main navigation bar
  • Click 'Add a Network' button and choose 'Custom Native Network' at the bottom of the page

In the Set Up Your Inventory section, for each Ad Unit that we will be using the Vungle SDK to present video ads we’ll need to do the following:

  • To ensure that the MoPub SDK can find the network adapter we used earlier to interact with the Vungle SDK:
    - If you are using reward ads, add "VungleRewardedVideoCustomEvent" as a Custom Event Class.
    - If you are using interstitial ads, add "VungleInterstitialCustomEvent" as a Custom Event Class.

  • We’ll also add our Vungle App ID in JSON format under Custom Event Class Data, e.g. { “appId” : “Test_iOS” }



Add Vungle as a Third-Party Ad Network

To add Vungle’s iOS SDK into your app using MoPub mediation, follow these steps:

  1. Add all the Vungle-related Adapter Files (under /AdNetworkSupport/Vungle/ in MoPUb SDK) 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 4.1.0 and copy the VungleSDK.embeddedframework folder into /AdNetworkSupport/Vungle/SDK/.

    • Make sure the project's Build Settings > Framework Search Path includes the VungleSDK.embeddedframework (for example: $(PROJECT_DIR)/AdNetworkSupport/Vungle/SDK/VungleSDK.embeddedframework)

    • Make sure VungleSDK.embeddedframework is included in the project's Build Phases > Link Binary With Libraries.

  3. Follow the instructions in the "Add other required frameworks" section of the Getting Started with Vungle (iOS) guide to add the necessary frameworks.

  4. Follow the instructions in the "Add the ObjC linker flag" section of the Getting Started with Vungle (iOS) guide to add the linker flag.

  5. Follow the instructions in the "Remove the iOS status bar" section of the Getting Started with Vungle (iOS) guide to remove the status bar.

  6. Follow the instructions in the "Application Transport Security (ATS)" section of the Getting Started with Vungle (iOS) guide to add the ATS exception.

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

For more information on how to set up MoPub’s interstitial ad controller, check out MoPub’s Interstitial Integration Guide for iOS. 

And that’s it! Vungle will now be rotated in through MoPub’s standard ad presentation waterfall.  If we want to manually set eCPMs to control waterfall positions we can do that under MoPub’s Segment Detail page on the MoPub dashboard.

Please check out MoPub’s help center for more information on the MoPub + Vungle integration!

Have more questions? Submit a request

Comments