Migrating from MoPub to Fyber FairBid (Unity)

Introduction

This article describes how to easily move your Unity project from MoPub to FairBid SDK.

Migration Process Overview

Follow these steps to complete the migration process.  Each step is described in detail below:

  1. Remove the MoPub SDK from your project
  2. Download the latest version of the FairBid SDK
  3. Update the mediated network adapters to the latest supported versions
  4. Update integration code to work with the FairBid SDK 
  5. Test your integration via Test Suite

Step 1: Removing the MoPub SDK From your Project

  1. Delete the MoPub manager from your Unity IDE:
      
  2. Delete the MoPub folder completely:
      

Step 2: Downloading the Latest Version of the FairBid SDK 

Fyber FairBid supports two methods for the integration of Unity:

  • Integration through Unity's Package Manager
  • Importing FairBid Unity Plugin Raw Package

For more information, click here.

Step 3: Ensuring your Network Adapters are Updated

For details on updating your network adapters, click here

You can find a list of the most recent supported network SDK adapter versions here.

Step 4: Changing Integration Code to Work with the FairBid SDK 

Initializing the FairBid SDK 

You must initialize the FairBid SDK using your Fyber App ID. This only needs to be performed once, ideally when the app is launched.  For more details, click here.  

If you want to report GDPR Consent, CCPA or COPPA per user, it is recommended to do this before your first init. You can learn more about it here.

MoPub FairBid
MoPub.InitializeSdk(SdkConfiguration); FairBid.Start("YOUR_APP_ID");

Rewarded Ads 

Rewarded ads are an engaging ad format that displays a short video ad to the user.  In exchange for viewing the video, the user earns a reward. The user must consent and watch the video completely through to the end to earn the reward.

Learn more about implementing Fyber FairBid Rewarded Video ads here.

API

  MoPub FairBid
Load Ad RequestRewardedVideo(adUnit, mediationSettings, keywords, latitude, longitude, customerId); Rewarded.Request(placementId);
Check HasRewardedVideo(adUnit); Rewarded.IsAvailable(placementId);
Show Ad ShowRewardedVideo(adUnit); Rewarded.Show(placementId);

Callbacks

MoPub FairBid
OnRewardedVideoLoadedEvent OnAvailable
OnRewardedVideoFailedEvent OnUnavailable
OnRewardedVideoExpiredEvent N/A
OnRewardedVideoShownEvent OnShow
OnRewardedVideoClickedEvent OnClick
OnRewardedVideoFailedToPlayEvent OnShowFailure
OnRewardedVideoReceivedRewardEvent OnCompletion
OnRewardedVideoClosedEvent OnHide
OnRewardedVideoLeavingApplicationEvent N/A
N/A OnRequestStart

Interstitials

Interstitials are static or video ads presented before, during or after the user interacts with your app. The user can view and then immediately dismiss them. This is a non-rewarded format for the user. The FairBid SDK supports both static and video interstitials.

Use FairBid APIs to Load and Show interstitial ads. Learn more about interstitial ads here.

API

  MoPub FairBid
Load RequestInterstitialAd(adUnit); Interstitial.Request(placementId);
Show ShowInterstitialAd(adUnit); Interstitial.Show(placementId);

Callbacks

MoPubManager FairBid Callbacks
OnInterstitialLoadedEvent OnAvailable
OnInterstitialFailedEvent OnUnavailable
OnInterstitialDismissedEvent OnHide
OnInterstitialExpiredEvent N/A
OnInterstitialShownEvent OnShow
OnInterstitialClickedEvent OnClick

Banners

Banners are rectangle ads appearing either at the top or bottom of the screen when the user interacts with your app. The user can view them but cannot dismiss them. Banners are automatically refreshed by the FairBid SDK after a specified period of time.

Learn more about FairBid banners implementation and features here.

API

  MoPub FairBid
Load RequestBanner(adUnit, position, size); FairBid loads the banner for you, you only need to invoke show banner method
Show ShowBanner(adUnit, true) Banner.Show(placementId);
Destroy DestroyBanner(adUnit); Banner.Destroy(placementId);

Callbacks

MoPubManager FairBid Callbacks
OnAdLoadedEvent OnLoad
OnAdFailedEvent OnError
OnAdClickedEvent OnClick
OnAdExpandedEvent Not supported
OnAdCollapsedEvent Not supported

Providing Banner Position

You can show your banner at the top or bottom of your screen. By default, the banner is placed at the bottom of the screen. If you want to change this behavior, use the following code:

Specifying banner position: 

string placementId = "1234";
BannerOptions bannerOptions = new BannerOptions();
bannerOptions.DisplayAtTheTop();
Banner.Show(placementId, bannerOptions);

Step 5: Testing your Integration via Test Suite

FairBid Test Suite allows you to check that your app is properly set-up and ready to mediate using FairBid mediation. FairBid Test Suite enables you to verify that the mediated networks you chose for the app are integrated successfully, Placements and Instances are set-up and run as expected and ads are served successfully.

Note

Documentation is available here.

Back to Top ⇧