Rewarded Video

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation Publisher UI, create an account, create an app, and setup ad placement using the format ‘Rewarded Video’. You can follow guides here.
  • Follow our steps to Android SDK Integration by integrating the SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad network SDKs and the corresponding adapters you wish to use to your app.
 

New in Version 2.0!

For Rewarded Video, Interstitial and Interactive Ad, the SDK will cache ads automatically and maintain ad inventory regularly, such as pre-loading after initialization, loading after ad served and timing loading etc. You have no need to invoke load method to cache ads by yourselves anymore with version 2.x.x. The new APIs are easier to use.

Rewarded Video

Rewarded Video Ad with strong interactive ability has become the mainstream form of mobile advertising industry. It is becoming increasingly common for mobile game developers to rely more on built-in ads than IAP to monetize.

The reward generally comes in the form of in-game currency (gold, coins, power-ups, etc.) and is distributed to the user after a successful video completion. We recommend that rewarded video ads be placed where users are already engaging with in-app purchases or where users may be seeking in-app rewards, such as at the end of the game level or at currency exchange points. After users complete their reward experience, you can designate the rewards they will receive.

The Rewarded Video ad unit offers an engaging ad experience that rewards your users with valuable virtual content in exchange for a completed view. This user-initiated ad unit is great for gaming apps, and enhances your apps experience. This section tells you how to init, load, and show Rewarded Video Ads. 

rewarded_video_ad.png

 
Step 1. Set the Rewarded Video Listener
 
The OpenMediation SDK fires several events to inform you of Rewarded Video Ad activity, such as ad availability and completions, so you will know whether and when to reward your users. To serve Rewarded Video Ad, you need to first set its listeners and process ad events. The following snippet demonstrates how to implement the RewardedVideoListener interface to receive video ad events.

The SDK will notify the listener of all possible events listed below:

import com.openmediation.sdk.utils.error.Error;
import com.openmediation.sdk.utils.model.Scene;
import com.openmediation.sdk.video.RewardedVideoAd;
import com.openmediation.sdk.video.RewardedVideoListener;
...
RewardedVideoAd.setAdListener(new RewardedVideoListener() {

    /**
     * Invoked when the ad availability status is changed.
     *
     * @param available is a boolean.
     *      True: means the rewarded videos is available and
     *          you can show the video by calling RewardedVideoAd.showAd().
     *      False: means no videos are available
     */
    @Override
    public void onRewardedVideoAvailabilityChanged(boolean available) {
        // Change the rewarded video state according to availability in app.
        // You could show ad right after it's was loaded here
    }

    /**
     * Invoked when the RewardedVideo ad view has opened.
     * Your activity will lose focus.
     */
    @Override
    public void onRewardedVideoAdShowed(Scene scene) {
        // Do not perform heavy tasks till the video ad is going to be closed.
    }

    /**
     * Invoked when the call to show a rewarded video has failed
     * @param error contains the reason for the failure:
     */
    @Override
    public void onRewardedVideoAdShowFailed(Scene scene, Error error) {
        // Video Ad show failed
    }

    /**
     * Invoked when the user clicked on the RewardedVideo ad.
     */
    @Override
    public void onRewardedVideoAdClicked(Scene scene) {
        // Video Ad is clicked
    }

    /**
     * Invoked when the RewardedVideo ad is closed.
     * Your activity will regain focus.
     */
    @Override
    public void onRewardedVideoAdClosed(Scene scene) {
        // Video Ad Closed
    }

    /**
     * Invoked when the RewardedVideo ad start to play.
     * NOTE:You may not receive this callback on some AdNetworks.
     */
    @Override
    public void onRewardedVideoAdStarted(Scene scene) {
        // Video Ad Started
    }

    /**
     * Invoked when the RewardedVideo ad play end.
     * NOTE:You may not receive this callback on some AdNetworks.
     */
    @Override
    public void onRewardedVideoAdEnded(Scene scene) {
        // Video Ad play end
    }

    /**
     * Invoked when the video is completed and the user should be rewarded.
     * If using server-to-server callbacks you may ignore this events and wait
     * for the callback from the OpenMediation server.
     */
    @Override
    public void onRewardedVideoAdRewarded(Scene scene) {
        // Here you can reward the user according to your in-app settings.
    }
});

Note:

  • The error parameter in onRewardedVideoAdShowFailed callback describes the cause of failure. Check the Error Code for more information and guidance on errors. 
  • The scene parameter in callbacks is according to the parameter sceneName in showAd method. You can add scenes in Placement Edit -> Placement Scenes of OpenMediation Publisher UI as below. Snip20201218_2.png

Step 2. Serve Rewarded Video Ad

Ad Availability

OpenMediation SDK automatic loads ads for you to cache the Rewarded Video Ads during application lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the RewardedVideoListener , you will be notified about the ad availability through the onRewardedVideoAvailabilityChanged callback. 

public void onRewardedVideoAvailabilityChanged(boolean available)

Another way to check if the ad is available is by calling the isReady() function directly. 

public boolean isReady()

Show Video Ad

Once you receive the onRewardedVideoAvailabilityChanged callback, you can invoke the showAd() method to serve a Rewarded Video Ad to your users. The sceneName parameter should be according to the Placement Scene Name list in Placement Settings -> Placement Scenes of OpenMediation Publisher UI.

public void showAd(String sceneName)

Note:

  • Scene is a new concept being introduced for rewarded video and interstitial ads in Version 2.0. It is used to represent different ad scenarios in your app. You can use Scene-based frequency control, user rewards and data statistic etc. Go to OpenMediation UI to create multiple Scenes in Settings of Placement.
  • Scene is optional,if you don't want to use it just ignore the sceneName parameter or use value "" as below.
//Use empty String as value if you don't need this functionality.
 RewardedVideoAd.showAd("")
 //Or ignore it.
 RewardedVideoAd.showAd()

We do not recommend showing ads in onRewardedVideoAvailabilityChanged callback directly, the Availability event only occurs when the ad availability changes, true or false, which does not necessarily mean it is the right time to serve ad. And showing ads in this callback unrestricted may result in frequent or even continuous ad pop-up, which will cause confusion for users and affect the experience. You should choose when your ads will show based on your application's ad plan.

//if you would like to show ad right after it's was loaded
public void onRewardedVideoAvailabilityChanged(boolean available) {
    if(available) {
        RewardedVideoAd.showAd(sceneName)
    }
}

 Warning!

  • Showing ads in onRewardedVideoAvailabilityChanged callback can cause unforeseen ad pop-ups. You should not do this unless it is happened only in a specific scenario and the necessary restrictions have been imposed on the invoking to showAd.

We strongly recommend checking the ad's availability by isReady method before you show Rewarded Video Ad to your users, as shown in the following code:

//if you would like to show ad when it's required
if (RewardedVideoAd.isReady()) {
    RewardedVideoAd.showAd(sceneName);
}

Notes:

  • When you have successfully completed step 2, you will have shown a Rewarded Video Ad to your users. If you want to serve another Rewarded Video Ad, you just repeat step 2 to check ad availability and show a new Rewarded Video Ad.

Capping and Pacing

You can use capping and pacing of scene to improve the user experience in your app by limiting the amount of ads served within a defined timeframe.  You can configure capping and pacing settings for selected scene in placement setting.

Important ! To ensure you don’t show the Rewarded Video button to prompt the user to watch an ad when the placement is capped, you must call the below method to verify if a specific placement has reached its ad limit.

RewardedVideoAd.isSceneCapped(sceneName);

 

Step 3. Reward the User

The OpenMediation SDK will fire the onRewardedVideoAdRewarded event each time the user successfully completes a video. The RewardedVideoListener will be in place to receive this event so you can reward the user successfully.

Make sure to set up your listener to grant rewards event in cases where onRewardedVideoAdRewarded is fired after the onRewardedVideoAdClosed event, because the onRewardedVideoAdRewarded and onRewardedVideoAdClosed events are asynchronous.

Server-to-Server Callbacks

OpenMediation SDK supports the rewarded video ad Server-side Callbacks. You can do this by defining a unique, private endpoint for us , and specify information that you want the OpenMediation server to pass. The way to works is the app on a user’s device will contact OpenMediation servers for validation of a reward. Once a user has been validated by the OpenMediation server, we will send notification to the endpoint defined in your dashboard. Since a user’s device will never be in contact with your server, this method prevents tampering with reward events sent to your endpoint.

Video ExtId

If your Rewarded Video Ad requires server-to-server data interoperability, you need to call setExtId to pass your user identity as below. This parameter is used to verify Rewarded transactions and must be set before calling showAd.

RewardedVideoAd.setExtId(scene, "Your Ext Id");

Configure Rewarded Video Ad Server-side Callback.

And you need to configure Rewarded Video Ad Server-side callback in Advanced settings of Placement. The guide is here.

Snip20201218_3.png

Endpoint Format

http://yourendpoint.com?variable_name_you_define={content}

{content} - the information that you want the OpenMediation server to pass. The user identity pass to setExtId will be set to {content}.

Done! 
You are now all set to deliver Rewarded Video ads in your app!

What's Next:

Follow our integration guides to integrate additional Rewarded Video Ad networks on our Mediation platform or configure additional Ad Units:

Was this article helpful?
1 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.