Follow

MoPub Plugin Integration

Important Notes

  • If you want to enable banner refresh, you should only do so with one SDK. Having refresh on both SDKs will result in duplicate requests. We recommend that you enable it for MoPub and disable it for AerServ.

 

 

Step 1: Download iOS SDK and Required Adapter Files

Download latest AerServ iOS SDK here. The downloaded ZIP file contains both the SDK library and adapter files.

 

Step 2: Configure Your Project

    1. Follow MoPub's instructions on setting up their SDK for your project.
    2. Unzip AerServ SDK ZIP file, and copy aerserv-ios-sdk/lib/AerServSDK.framework into your project's libs folder.
    3. Copy all Objective-C files from aerserv-ios-sdk/network-support/MoPub/AerServCustomEvents into your project's source folder.
    4. You must initialize our SDK. We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad (a good location would be your AppDelegate’s application:didFinishingWithOptions ).
      • To initialize the SDK, invoke the following:

        AerServSdk.init(MainActivity.this, MY_APP_ID);
      • How to obtain the app ID:
        1. Log on to the AerServ platform.
        2. Go to the 'Inventory' tab in the top navigation bar.
        3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
        4. You will find the app ID at the very top of the page.
    5. To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s +setGDPRWithUserConsent: method. Pass YES/true for user consent if GDPR user consent was granted and NO/false if user consent was denied or if unknown. To have the GDPR user consent flag to be set before an ad request, call +setGDPRWithUserConsent: before calling -loadAd. It is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

      // Replace YES with the actual consent value of user consent.
      [AerServSDK setGDPRWithUserConsent:YES];

 

Step 3: Configure Ad Settings on AerServ Web Interface

            1. Follow instruction to set up AerServ Placements and Ad Sources.
            2. For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with MoPub instead.

 

Step 4: Configure Ad Settings on MoPub Web Interface

            1. (Optional) Create a new AdUnit with the ad type that you'll like to use AerServ with. You can use a existing AdUnit if one already exist.
            2. Now go to the 'Orders' tab and click on Create order. Creating a new 'Order' is optional. You can use a existing order if one already exist. If you decide to use a exist order, you will need to create a new Line Item instead.
            3. When creating a new Order/Line Item, use the following parameters:
                • Advertiser: AerServ
                • Type & Priority: Network
                • Network: Custom Native Network
                • Class: Use one of the following class names. If you changed the package name please change the classpath to correspond with the new package name.
                  • For Banner: AerServCustomEventBanner
                  • For Interstitial: AerServCustomEventInterstitial
                  • For Rewarded Video: AerServCustomEventRewardedInterstitial
                  • For Native Static: AerServCustomEventNativeAd
                • eCPM: You will need to the eCPM from the AerServ dashboard. If you have any question please contact our support.
                • Data: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advanced Topics > Server Parameters for more information.
                • Ad Unit: Select the newly created AdUnit created or use existing a AdUnit.

  

Step 5: Request Ads

Follow MoPub instructions to request banner, interstitial, or native static ads, but using ad units that you created in Step 3 above. There are no different or special API calls to fetch AerMarket ads, as all mediation is done automatically for you by the adapters.

 

For Native Static:

The AerServ MoPub Native Plugin utilizes MoPub’s AdPlacer native integration implementation.

When setting up the Ad Placer, an additional render configuration will be passed in for AerServ. Create an AerServCustomNativeAdRendererSettings object. Setting the renderingViewClass and viewSizeHandler properties. Then utilizing the newly created settings create a MPNativeAdRendererConfiguration object with the static method +rendererConfigurationWithRenderSettings: from AerServCustomNativeAdRenderer. Add this render configuration object into the render configuration array that’s passed into your ad placer.

// setup AerServNativeAdRendererSettings
AerServNativeAdRendererSettings* asNativeSettings = [AerServNativeAdRendererSettings new];
asNativeSettings.renderingViewClass = [MoPubCell class];
asNativeSettings.viewSizeHandler = sizeHandler;
MPNativeAdRendererConfirguration * asNativeRenderConfig = [AerServNativeAdRenderer rendererConfigurationWithRendererSettings:asNativeSettings];
NSArray* renderConfigArr = @[asNativeRenderConfig];

 

Advanced Topics

Server Parameters

AerServ server ad parameters must be in JSON format.  Currently we support these parameters:

 

NAME TYPE REQUIRED DEFAULT DESCRIPTION

placement

String

Yes

N/A

AerServ Placement

 

Here is a sample value:

{ 
"placement": "1000731"
}

 

Event Mapping

AerServ banner events are mapped to MoPub's MPAdViewDelegate events, as follows:

-adViewDidLoadAd: -bannerCustomEvent:didLoadAd:

-adViewDidFailToLoadAd:withError:-bannerCustomEvent:didFailToLoadAdWithError:

-willLeaveApplicatonFromAd:-bannerCustomEventWillLeaveApplication:

-adWasClicked:-bannerCustomEventWillBeginAction:

-didDismissModalViewForAd:-bannerCustomEventDidFinishAction:

 

AerServ interstitial events are mapped to MoPub's MPInterstitialAdControllerDelegate events, as follows:

-interstitialViewControllerDidPreloadAd: -interstitialCustomEvent:didLoadAd:

-interstitialViewControllerAdFailedToLoad:withError:-interstitialCustomEvent:didFailToLoadAdWithError:

-interstitialViewControllerWillDisappear: -interstitialCustomEventWillDisappear:

-interstitialViewControllerDidDisappear:-interstitialCustomEventDidDisappear:

-interstitialViewControllerWillAppear:-interstitialCustomEventWillAppear:

-interstitialViewControllerDidAppear:-interstitialCustomEventDidAppear:

-interstitialViewControllerAdWasTouched:-interstitialCustomEventDidReceiveTapEvent:

 

AerServ rewarded video events are mapped to MoPub's MPRewardedVideoAdManagerDelegate events, as follows:

-interstitialViewControllerDidPreloadAd: -rewardedVideoDidLoadAdForCustomEvent:

-interstitialViewControllerAdFailedToLoad:withError:-rewardedVideoDidFailToLoadAdForCustomEvent:error:

-interstitialViewControllerWillDisappear: -rewardedVideoWillDisappearForCustomEvent:

-interstitialViewControllerDidDisappear:-rewardedVideoDidAppearForCustomEvent:

-interstitialViewControllerWillDisappear:-rewardedVideoWillAppearForCustomEvent:

-interstitialViewControllerDidAppear:-rewardedVideoWillAppearForCustomEvent:

-interstitialViewControllerAdWasTouched:-rewardedVideoDidReceiveTapEventForCustomEvent:

-interstitialViewControllerDidVirtualCurrencyReward:vcData:-rewardedVideoShouldRewardUserForCustomEvent:reward:

  

AerServ native static events are mapped to MoPub’s MPNativeCustomEventDelegate events, as follows:

-nativeAd:didFailToLoadWithError: -nativeCustomEvent:didFailToLoadAdWithError:

-nativeAdDidPreload:-nativeCustomEvent:didLoadAd:

 

 

Step 1: Download Android SDK and Required Adapter Files

Download latest AerServ Android SDK here. The downloaded ZIP file contains both the SDK library and adapter files.

 

Step 2: Configure Your Project

  1. Follow MoPub's instructions on setting up their SDK for your project.
  2. Unzip AerServ SDK ZIP file, and copy aerserv-android-sdk/lib/aerserv-sdk.jar into your project's libs folder.
  3. Copy all Java files from aerserv-android-sdk/network-support/MoPub into your project's source folder. These adapter files have com.mopub.mobileads as package name. You can either put them in the corresponding destination folder, or you can change the package name at the top of each adapter file.
  4. Add the following...
    • Permissions AndroidManifest.xml: 
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    • Activities AndroidManifest.xml:
      
      <activity
             android:name="com.aerserv.sdk.view.AerServFullScreenAdActivity"
             android:theme="@android:style/Theme.Translucent"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity
             android:name="com.aerserv.sdk.view.ASVastInterstitialActivity"
             android:theme="@android:style/Theme.Translucent"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity 
             android:name="com.aerserv.sdk.view.ASWebviewInterstitialActivity" 
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity 
             android:name="com.aerserv.sdk.view.ASVpaidInterstitalActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
             android:hardwareAccelerated="true" />
  5. You must initialize our SDK.  We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad (a good location would be your main activity's onCreate() method).

     

    • To initialize the SDK, invoke the following:
    AerServSdk.init(MainActivity.this, MY_APP_ID);
    • How to obtain the app ID:
      1. Log on to the AerServ platform.
      2. Go to the 'Inventory' tab in the top navigation bar.
      3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
      4. You will find the app ID at the very top of the page.
  6. To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s setGdprConsentFlag method. Pass true for user consent if GDPR user consent was granted and false if user consent was denied or if unknown. To have the GDPR user consent flag be set prior to an ad request, call the setGdprConsentFlag method before requesting an ad. The value passed into setGdprConsentFlag will persist as a private value within Android’s SharedPreferences. Thus, it is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

    AerServSdk.setGdprConsentFlag((Activity) MY_ACTIVITY, (boolean) true);

 

Step 3: Configure Ad Settings on AerServ Web Interface

            1. Follow instruction to set up AerServ Placements and Ad Sources.
            2. For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with MoPub instead.

 

Step 4: Configure Ad Settings on MoPub Web Interface

            1. (Optional) Create a new AdUnit with the ad type that you'll like to use AerServ with. You can use a existing AdUnit if one already exist.
            2. Now go to the 'Orders' tab and click on Create order. Creating a new 'Order' is optional. You can use a existing order if one already exist. If you decide to use a exist order, you will need to create a new Line Item instead.
            3. When creating a new Order/Line Item, use the following parameters:
                • Advertiser: AerServ
                • Type & Priority: Network
                • Network: Custom Native Network
                • Class: Use one of the following class names. If you changed the package name please change the classpath to correspond with the new package name.
                  • For Banner: com.mopub.mobileads.AerServCustomEventBanner
                  • For Interstitial: com.mopub.mobileads.AerServCustomEventInterstitial
                  • For Rewarded Video: com.mopub.mobileads.AerServCustomEventRewardedInterstitial
                • eCPM: You will need to the eCPM from the AerServ dashboard. If you have any question please contact our support.
                • Data: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advanced Topics > Server Parameters for more information.
                • Ad Unit: Select the newly created AdUnit created or use existing a AdUnit.

 

Step 5: Request Ads

Follow MoPub instructions to request banner or interstitial, but using ad units that you created in Step 3 above. There are no different or special API calls to fetch AerMarket ads, as all mediation is done automatically for you by the adapters.

 

 

Advanced Topics

Server Parameters

AerServ server ad parameters must be in JSON format.  Currently we support these parameters:

 

NAME TYPE REQUIRED DEFAULT DESCRIPTION

placement

String

Yes

N/A

AerServ Placement

 

Here is a sample value:

{ 
"placement": "1000731"
}

 

Event Mapping

AerServ banner events are mapped to MoPub's CustomEventBanner events, as follows:

AD_LOADED onBannerLoaded()

AD_FAILEDonBannerFailed()

AD_CLICKEDonBannerClicked()

 

AerServ interstitial events are mapped to MoPub's CustomEventInterstitial events, as follows:

PRELOAD_READYonInterstitialLoaded()

AD_FAILEDonInterstitialFailed()

AD_IMPRESSION onInterstitialShown()

AD_CLICKEDonInterstitialClicked()

AD_DISMISSEDonInterstitialDismissed()

 

AerServ rewarded video events are mapped to MoPub's CustomEventRewardedVideo events, as follows:

PRELOAD_READYonRewardedVideoLoadSuccess()

AD_FAILEDonRewardedVideoLoadFailure()

VIDEO_START onRewardedVideoStarted()

AD_CLICKEDonRewardedVideoClicked()

AD_DISMISSEDonRewardedVideoClosed()

VC_REWARDED → onRewardedVideoCompleted()

 

Error Codes

AerServ adapter will fire the following MoPub errors using their AdRequest error enum:

 

ADREQUEST ENUM CONDITION

NETWORK_NO_FILL

AerServ SDK fired AD_FAILED event. See AerServ SDK documentation for more details.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments