In addition to static interstitial and video ads, AdRally also mediates a number of rewarded video providers that can be used to award your players game currency in exchange for watching video ads. Rewarded video ads differ from normal video placements in that they return a different callback when they have been viewed to completion. Your game’s logic can then use this callback to award currency to the player.
Setting Up A Zone
In order you implement rewarded video, you’ll need to create an ad zone by calling the platform-specific showAd method and passing in a string argument for the zone name. Note that this will need to occur after having started a session using your game’s unique API key. Once called, the newly named zone will appear in the AdRally/Zones section of your dashboard. From there you can adjust the content settings to serve in rewarded videos.
Changing Zone Content
Once your zone has been created, you’ll need to adjust the content settings to only include rewarded video. Make sure that the Static (Non-Video) and Video settings have been disabled and the Rewarded Video setting has been enabled. Also make sure that the Use Default setting is unchecked. Once updated, anytime your game client calls showAd with the proper associated zone name, it will only serve rewarded ads.
Checking Ad Availability
With your content format set, you’ll want to make sure that there are rewarded ads available before signalling your players that they can be viewed. Call the platform specific checkAdAvailable method with the appropriate zone name passed in. An AdAvailabilityResponse callback will be returned letting you know whether or not an ad is available for the specified zone.
Once the content format of the zone has been set in the dashboard and you’ve confirmed that there are ads available, calling showAd with the appropriate rewarded zone name will show a rewarded ad. The callback returned when a rewarded ad is viewed to completion is different than a normal ad view callback.
Where as a normal static interstitial or video ad would return the “AdWillClose” callback, a rewarded video, when viewed to completion, will return “RewardedVideoCompleted”. If a rewarded video is closed or skipped before completion, the standard “AdWillClose” callback will be returned.
RewardedVideoCompleted callbacks for each platform are as follows:
- (void) rewardedVideoCompleted:(NSString*) _zoneID; //NSString parameter contains ad zone
- public abstract void rewardedVideoCompleted(String adZone); //string parameter contains ad zone
- public static event Action<string> RewardedVideoCompleted; //string parameter contains ad zone
- public function onStatus( event : StatusEvent ) : void //event.code is AirFuseAPIEvent.AD_REWARD_COMPLETE //event.level contains ad zone
Once the RewardedVideoCompleted callback is returned, the game client’s logic will need to handle what type and amount of currency is rewarded. The AdRally system does not provide functionality for dynamically tuning these values. For this reason, we highly recommend using server side variables to tune these amounts to allow for greater optimization capabilities.