Ad Formats

After creating placements in the DT Console, add the following code snippets in the chosen context of your app. Access the Placement ID using the copy button next to the placement name. For more information about creating placements in the DT Console, read here.

DT supports the following ad types:

Banner Ads

Banners are rectangular ads that appear at the top or bottom of the screen when the user interacts with your app. The user can view banners but cannot dismiss them. The DT FairBid SDK automatically refreshes banners after 20 seconds.

Note

The DT FairBid SDK automatically refreshes banners. To avoid discrepancies between DT and third-party network reporting, disable any automatic or manual banner refresh settings on third-party network SDKs.

Showing a Banner

Implement the code below to show a Banner:

Android iOS Unity
Kotlin
val placementId = "12345"
Banner.show(placementId, activity)
Java
String placementId = "12345";
Banner.show(placementId, activity);

Hiding the Banner

If you want to hide the banner temporarily, implement the code below:

Android iOS Unity
Kotlin
//hides the banner for a specific placement
val placementId = "12345"
Banner.hide(placementId)

Java
//hides the banner for a specific placement
String placementId = "12345";
Banner.hide(placementId);

Destroying the Banner

Once you have decided that you no longer want to use the banner, you must destroy it.

To destroy the banner, implement the code below:

Android iOS Unity
Kotlin
//destroys the banner for a specific placement
val placementId = "12345"
Banner.destroy(placementId)
Java
//destroys the banner for a specific placement
String placementId = "12345";
Banner.destroy(placementId);

Banner Position

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

Android iOS Unity

Top

Kotlin
val bannerOptions = BannerOptions().placeAtTheTop()
val placementId = "12345"
Banner.show(placementId, bannerOptions, activity)
Java
BannerOptions bannerOptions = new BannerOptions().placeAtTheTop();
String placementId = "12345";
Banner.show(placementId, bannerOptions, activity);

Custom View

Kotlin
val bannerOptions = BannerOptions().placeInContainer(viewGroup)
val placementId = "12345"
Banner.show(placementId, bannerOptions, activity)
Java
BannerOptions bannerOptions = new BannerOptions().placeInContainer(viewGroup);
String placementId = "12345";
Banner.show(placementId, bannerOptions, activity);)

Loading a Banner

Important

Use this implementation only if FairBid is not your main mediation platform.

If you want to use FairBid with other mediations or demand sources, you can pre-load a banner to review its pricing and other details. This allows you to compare it against banners from other demand sources outside our platform before showing it.

Android iOS Unity

To load a banner, create a BannerView object instance and then call the load method. Please be aware that this integration method disables banner refresh, and you must add your own refresh logic.

This is supported starting FairBid Android SDK 3.51.0.

Kotlin
val bannerContainer: FrameLayout
val placementId = "12345"

val bannerView = BannerView(requireContext(), placementId)
banner.bannerListener = object : BannerListener {
  //...
}
bannerView.load()

//Once the ad is loaded and ready, you can check the pre-impression data
val impressionData = bannerView.impressionData

// To show the banner, attach the bannerView to the Banner Container
bannerContainer.addView(bannerView)

//Once the banner is no longer needed, you can destroy it
bannerView.destroy()
          

Adaptive Banners

By enabling the adaptive banner feature, you can receive the best banner size based on the ad width and screen size. This feature is currently supported by Google AdMob, Google Bidding, and Google Ad Manager only. This feature is disabled by default.

Networks that support adaptive banners will return ads with the best-fit height based on your banner size. Other networks will continue to deliver banners according to the specified ad size.

To use this feature, add the adaptive flag when defining your banner size using the code below:

Android iOS Unity
Kotlin
val bannerOptions = BannerOptions().setAdaptive(true)
val placementId = "12345"
Banner.show(placementId, bannerOptions, activity)
Java
BannerOptions bannerOptions = new BannerOptions().setAdaptive(true);
String placementId = "12345";
Banner.show(placementId, bannerOptions, activity);

Adding Callbacks

The callback code below is required for the SDK to properly track the activity of your ad.

Android iOS Unity
Kotlin
Banner.setBannerListener(object : BannerListener {
    override fun onError(placementId: String, error: BannerError) {
        // Called when an error arises when showing the banner from placement 'placementId'
    }

    override fun onLoad(placementId: String) {
        // Called when the banner from placement 'placementId' is successfully loaded
    }

    override fun onShow(placementId: String, impressionData: ImpressionData) {
        // Called when the banner from placement 'placementId' is shown
    }

    override fun onClick(placementId: String) {
        // Called when the banner from placement 'placementId' is clicked
    }

    override fun onRequestStart(placementId: String, requestId: String) {
        // Called when the banner from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow
    }
})
Java
Banner.setBannerListener(new BannerListener() {
    @Override
    public void onError(String placementId, BannerError error) {
        // Called when an error arises when showing the banner from placement 'placementId'
    }
 
    @Override
    public void onLoad(String placementId) {
        // Called when the banner from placement 'placementId' is successfully loaded
    }
 
    @Override
    public void onShow(String placementId, ImpressionData impressionData) {
        // Called when the banner from placement 'placementId' is shown
    }
 
    @Override
    public void onClick(String placementId) {
        // Called when the banner from placement 'placementId' is clicked
    }
 
    @Override
    public void onRequestStart(String placementId, String requestId) {
        // Called when the banner from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow
    }
});

Interstitial Ads

Interstitials are either 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.

Note

The speed and stability of a user's internet connections may vary. It is highly recommended to fetch as much in advance of showing an ad as possible. This helps to ensure that all necessary assets are downloaded. For example, you may want to fetch an ad when a level starts or after a previous ad has been shown.

Making the Request

Below is an example of making a request for an Intersitial.

Android iOS Unity
Kotlin
import com.fyber.fairbid.ads.Interstitial

val placementId = "12345"
Interstitial.request(placementId)
Java
import com.fyber.fairbid.ads.Interstitial;

String placementId = "12345";
Interstitial.request(placementId);

Adding Callbacks

The callback code below is required for the SDK to properly track the activity of your ad

Android iOS Unity
Kotlin
Interstitial.setInterstitialListener(object : InterstitialListener {
    override fun onShow(placementId: String, impressionData: ImpressionData) {
        // Called when the interstitial from placement 'placementId' shows up. 
        // In case the ad is a video, audio play will start here.
    }

    override fun onClick(placementId: String) {
        // Called when the interstitial from placement 'placementId' is clicked
    }

    override fun onHide(placementId: String) {
        // Called when the interstitial from placement 'placementId' hides.
        // In case the ad is a video, audio play will stop here.
    }

    override fun onShowFailure(placementId: String, impressionData: ImpressionData) {
        // Called when an error arises when showing the interstitial from placement 'placementId'
    }

    override fun onAvailable(placementId: String) {
        // Called when an interstitial from placement 'placementId' becomes available
    }

    override fun onUnavailable(placementId: String) {
        // Called when an interstitial from placement 'placementId' becomes unavailable
    }

    override fun onRequestStart(placementId: String, requestId: String) {
        // Called when an interstitial from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow
    }
})
Java
Interstitial.setInterstitialListener(new InterstitialListener() {
    @Override
    public void onShow(String placementId, ImpressionData impressionData) {
        // Called when the interstitial from placement 'placementId' shows up. 
        // In case the ad is a video, audio play will start here.
    }
 
    @Override
    public void onClick(String placementId) {
        // Called when the interstitial from placement 'placementId' is clicked
    }
 
    @Override
    public void onHide(String placementId) {
        // Called when the interstitial from placement 'placementId' hides. 
        // In case the ad is a video, audio play will stop here.
    }
 
    @Override
    public void onShowFailure(String placementId, ImpressionData impressionData) {
        // Called when an error arises when showing the interstitial from placement 'placementId'
    }
 
    @Override
    public void onAvailable(String placementId) {
        // Called when a interstitial from placement 'placementId' becomes available
    }
 
    @Override
    public void onUnavailable(String placementId) {
        // Called when a interstitial from placement 'placementId' becomes unavailable
    }
  
  	@Override
    public void onRequestStart(String placementId, String requestId) {
        // Called when a interstitial from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow
    }
});

Example Showing an Ad

The following example checks to see if a Placement is available and if it is, uses the show request to display the ad.

Android iOS Unity
Kotlin
val placementId = "12345"
if (Interstitial.isAvailable(placementId)) {
    Interstitial.show(placementId, context)
}

Java
String placementId = "12345";
if (Interstitial.isAvailable(placementId)) {
    Interstitial.show(placementId, context);
}

Rewarded Ads

Rewarded ads are an engaging ad format that shows a short video ad to the user and in exchange the user will earn a reward. The user must consent and watch the video completely through to the end in order to earn the reward.

Note

The speed and stability of users internet connections may vary. It is highly recommended to fetch as far in advance of showing an ad as possible. This helps to ensure that all necessary assets are downloaded. For example, you may want to fetch an ad when a level starts, or after a previous ad has been shown.

Making the Request

The following example shows how to make a request to display the Rewarded ads.

Android iOS Unity

Before you can make a request to display a Rewarded ad, you must import the Rewarded class.

Kotlin
import com.fyber.fairbid.ads.Rewarded
Java
import com.fyber.fairbid.ads.Rewarded;

After importing the Rewarded class, you must make a request to display the Rewarded ads.

Kotlin
import com.fyber.fairbid.ads.Rewarded

val placementId = "12345"
Rewarded.request(placementId)
Java
import com.fyber.fairbid.ads.Rewarded;
 
String placementId = "12345";
Rewarded.request(placementId);

Adding Callbacks

The callback code below is required for SDK to track the activity of your ad properly.

Android iOS Unity
Kotlin
Rewarded.setRewardedListener(object : RewardedListener {
    override fun onShow(placementId: String, impressionData: ImpressionData) {
        // Called when the rewarded ad from placement 'placementId' shows up. 
        // In case the ad is a video, audio play will start here.
    }

    override fun onClick(placementId: String) {
        // Called when the rewarded ad from placement 'placementId' is clicked
    }

    override fun onHide(placementId: String) {
        // Called when the rewarded ad from placement 'placementId' hides. 
        // In case the ad is a video, audio play will stop here.
    }

    override fun onShowFailure(placementId: String, impressionData: ImpressionData) {
        // Called when an error arises when showing the rewarded ad from placement 'placementId'
    }

    override fun onAvailable(placementId: String) {
        // Called when a rewarded ad from placement 'placementId' becomes available
    }

    override fun onUnavailable(placementId: String) {
        // Called when a rewarded ad from placement 'placementId' becomes unavailable
    }

    override fun onCompletion(placementId: String, userRewarded: Boolean) {
        // Called when a rewarded ad from placement 'placementId' finishes playing
    }

    override fun onRequestStart(placementId: String, requestId: String) {
        // Called when a rewarded ad from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow
    }
})
Java
Rewarded.setRewardedListener(new RewardedListener() {
    @Override
    public void onShow(String placementId, ImpressionData impressionData) {
        // Called when the rewarded ad from placement 'placementId' shows up. In case the ad is a video, audio play will start here.
    }
 
    @Override
    public void onClick(String placementId) {
        // Called when the rewarded ad from placement 'placementId' is clicked
    }
 
    @Override
    public void onHide(String placementId) {
        // Called when the rewarded ad from placement 'placementId' hides. In case the ad is a video, audio play will stop here.
    }
 
    @Override
    public void onShowFailure(String placementId, ImpressionData impressionData) {
        // Called when an error arises when showing the rewarded ad from placement 'placementId'
    }
 
    @Override
    public void onAvailable(String placementId) {
        // Called when a rewarded ad from placement 'placementId' becomes available
    }
 
    @Override
    public void onUnavailable(String placementId) {
        // Called when a rewarded ad from placement 'placementId' becomes unavailable
    }
 
    @Override
    public void onCompletion(String placementId, boolean userRewarded) {
        // Called when a rewarded ad from placement 'placementId' finishes playing 
    }
 
    @Override
    public void onRequestStart(String placementId, String requestId) {
        // Called when a rewarded ad from placement 'placementId' is going to be requested
        // 'requestId' identifies the request across the whole request/show flow 
    }
});

Example showing an ad

The following example checks to see if a placement is available and, if it is, uses the show request to display the ad.

Android iOS Unity
Kotlin
val placementId = "12345"
if (Rewarded.isAvailable(placementId)) {
    Rewarded.show(placementId, context)
}
Java
val placementId = "12345"
if (Rewarded.isAvailable(placementId)) {
    Rewarded.show(placementId, context)
}

Server Side Rewarding

Android iOS Unity
Refer to the provided documentation for detailed instructions on configuring Server-Side Rewarding.

Medium Rectangle Ads

Medium Rectangle (MREC) ads are 300x250 sized ads, serving both static and video, and positioned within editorial content of the app. There is no close button on MREC ads, and they are not skippable. Similar to Banner ads, MREC ads are refreshed according to a set refresh rate of between 10-120 seconds.

Note

MREC Ads are available from FairBid SDK version 3.33.1.

Showing an MREC

Implement the code below to show an MREC:

Android iOS Unity
Kotlin
fun showBanner() {
    val bannerOptions = BannerOptions().withSize(BannerSize.MREC)
            // if you don't specify your container view,
            // we'll display it at the bottom of the screen
            .placeInContainer(YOUR_CONTAINER_VIEW_GOES_HERE)
    Banner.show("placementId", bannerOptions, activity)
}
Java
private void showBanner() {
    BannerOptions bannerOptions = new BannerOptions().withSize(BannerSize.MREC)
        // if you don't specify your container view,
        // we'll display it at the bottom of the screen
        .placeInContainer(YOUR_CONTAINER_VIEW_GOES_HERE);
    Banner.show("placementId", bannerOptions, activity);
}

Back to Top ⇧