iOS SDK MoPub Adapter

56 views 27/12/2017 Shay Karpeles 0

Getting Started

This document details the process of integrating YouAppi’s SDK MoPub adapter with your iOS app.

If you have any question you can email us to: sdk@youappi.com

The basic steps of integration are:

  • Integrate YouAppi SDK using YouAppi SDK integration document.
  • Add YouAppi MoPub mediation files to your project.
  • Follow the instructions below.

Download YouAppi’s iOS SDK MoPub Adapter

iOS SDK MoPub adapter can be found in YouAppi’s iOS SDK package.

Setup

  • Install YouAppi iOS SDK as described in the document.
  • In the SDK zip file extract the files in the package: youappi-sdk-ios-mopub.zip.
  • Drag the extracted files and drop them on your XCode project.
  • Make sure to select “Copy items if needed”:

Create YouAppi custom network

  • On MoPub platform on Networks tab, add a new custom network for YouAppi:
  • On the popup that opens choose to add a Custom Native Network.
  • Name your new network (YouAppi might be a good name) and fill other relevant details.

Setup MoPub for YouAppi Ad units

Create rewarded video ad anit

  • On your MoPub account, press Apps tab.
  • Select your iOS app for which you would like or create the new ad unit or create a new iOS app.

  • On your app screen press “New ad unit” button:

  • Name your add unit, select Format: Rewarded Video and press Save

Create Interstitial Video or Interstitial Ad units

  • Assuming you already created an iOS app, press Apps tab and from the apps list choose your iOS app.
  • Press New ad unit button to define a new ad unit for either Interstitial Video or Interstitial Ad.
  • Name you ad unit, choose relevant device and on format choose Fullscreen:

Setup Ad Unit on network

  • Choose Networks and select your YouAppi custom network.
  • On network details screen choose Edit Network.
  • On Set Up Your Inventory section, connect between your iOS app ad unit and YouAppi by setting the proper Custom Event Class.
  • For each ad unit type there is a different custom event class:
    • Rewarded Video: YAMoPubRewardedVideoAdEvent
    • Interstitial Video: YAMoPubInterstitialVideoAdEvent
    • Interstitial Ad: YAMoPubInterstitialAdEvent

Enable YouAppi ad unit to run on YouAppi custom network

  • Press Segments tab and choose your desired segment.
  • Under your iOS app find your desired ad unit and YouAppi custom network.
  • Switch your network to running by pressing the button under Enabled column:

Use MoPub SDK to show YouAppi ad units

Rewarded Video

Load

// Initialize rewarded video before loading any ads
[[MoPub sharedInstance] initializeRewardedVideoWithGlobalMediationSettings:nil delegate:self];
     
// Load rewarded video ad
[MPRewardedVideo loadRewardedVideoAdWithAdUnitID:"MoPubRewardedUnitID" withMediationSettings:nil];

Show

if ([MPRewardedVideo hasAdAvailableForAdUnitID:"MoPubRewardedUnitID"]){
  [MPRewardedVideo presentRewardedVideoAdForAdUnitID:"MoPubRewardedUnitID" fromViewController:self];
}

Interstitial Video

Load

interstitialVideo = [MPInterstitialAdController interstitialAdControllerForAdUnitId: "MoPubInterstitialVideoUnitID"];
interstitialVideo.delegate = self;
[interstitialVideo loadAd];

Show

if (interstitialVideo.ready){
  [interstitialVideo showFromViewController:self];
}

Interstitial Ad

Load

interstitialAd = [MPInterstitialAdController interstitialAdControllerForAdUnitId:"MoPub InterstitialADUnitID"];
interstitialAd.delegate = self;
[interstitialAd loadAd];

Show

if (interstitialAd.ready){
  [interstitialAd showFromViewController:self];
}