iOS rewarded video implementation

Rewarded video ad is an advertisement format that displays video ads of approximate from 15 to 30 seconds and gives users items or points in the application.

For Geniee SDK, mediation adapter displays rewarded video advertisements of each 3rd ad network.

Preparing to install

To prepare for implementation of reward video ads, please follow the guide below. You need to install Geniee SDK to your project. Start Guide

  • SDK for each ad network, adapters The following settings are required for RewardVideo.
  1. Setting of SDK for each ad network
  2. Adapter setting is required.

Refer to the installation method from the link below.

Ad network Version
maio 1.4.0
AppLovin 5.1.1
Unity Ads 2.3.0
AdColony 3.3.5
CAReward 2.3.1
Tapjoy 12.0.0
Vungle 6.2.0
Nend 5.0.2
AMoAd playable1.0.0
TikTok 2.4.6.7

Sample project

Objective-C

https://github.com/geniee-ssp/Geniee-iOS-SDK/tree/master/sample/use_cocoapods/objectivec

Swift

https://github.com/geniee-ssp/Geniee-iOS-SDK/tree/master/sample/use_cocoapods/swift

Classes & protocols

The following classes are used for iOS rewarded video delivery. GNSRequest.h GNSRewardVideoAd.h GNSRewardVideoAdDelegate.h

Implementation

Import header file and add Delegate

Example:ViewController.h

#import <GNAdSDK/GNSRewardVideoAd.h>
#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSAdReward.h>
#import <GNAdSDK/GNSRewardVideoAdDelegate.h>
@interface ViewController <GNSRewardVideoAdDelegate>
1
2
3
4
5

Delegate method implementation

  • This implementation is optional.

In the RewardVideo Ad SDK, set Delegate.

If you want to handle the following delgate, please implement delgate in ViewController which receives callback. If you describe it in viewDidLoad, viewDidLoad will not be executed after screen transition, delegate may not be set in some cases. The life cycle of iOS is involved.

Example:Viewcontroller.m (viewWillAppear recommended)

viewWillAppeare(){
    [GNSRewardVideoAd sharedInstance].delegate = self;
}
1
2
3

To receive notification from the SDK, implement the method of GNSRewardVideoAdDelegate.

Example:Viewcontroller.m

/// Define the failure to reload video ads in delegates.
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
    didFailToLoadWithError:(NSError *)error {
}

/// Define the load of Rewards video ad with delegate.
- (void)rewardVideoAdDidReceiveAd:(GNSRewardVideoAd *)rewardVideoAd {
}

/// Define the start of replay video ad playback in the delegate.
- (void)rewardVideoAdDidStartPlaying:(GNSRewardVideoAd *)rewardVideoAd {
}

/// Define that a delegate will close a Rewards video ad.
- (void)rewardVideoAdDidClose:(GNSRewardVideoAd *)rewardVideoAd {
}

/// Define rewards for users of reward video ads in delegates.
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
    didRewardUserWithReward:(GNSAdReward *)reward {
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Load rewarded video ad load

Set load request to ZoneID (App ID) and request video ad load.

Note:

Load requests can take several seconds or more, so loadRequest video reward ads early in the application lifecycle.

If you want to display another video ad after a single video ad appears, you will need to run loadRequest again.

  • If you're using Geniee SDK version later than 7.0.0
GNSRequest *request = [GNSRequest request];
[[GNSRewardVideoAd sharedInstance] loadRequest:request
                                   withZoneID:@"YOUR_SSP_ZONE_ID" isRTB:true];
1
2
3
  • isRTB: true to get ads from RTB (Real Time Bidding), false to get ads from mediation

  • If you're using Geniee SDK version earlier than 7.0.0 such as 6.2.1

GNSRequest *request = [GNSRequest request];
[[GNSRewardVideoAd sharedInstance] loadRequest:request
                                   withZoneID:@"YOUR_SSP_ZONE_ID"]; // Deprecated
1
2
3

Display rewarded video

Make sure the video ad is ready and display the video ad.

if ([[GNSRewardVideoAd sharedInstance] canShow]) {
   [[GNSRewardVideoAd sharedInstance] show:self];
}
1
2
3

Give users a reward

To maximize revenue with video ads, it is important to remunerate video ad viewers. GNSAdReward includes the following items.

  • reward.type:SSP currency type setting
  • reward.amount:SSP currency amount setting

Use didRewardUserWithReward callback method to reward users

- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
didRewardUserWithReward:(GNSAdReward *)reward
{
   NSLog(@"ViewController: Reward received type=%@, amount=%lf"
    ,reward.type
    ,[reward.amount doubleValue]);
}
1
2
3
4
5
6
7

ATS setting

Add the following to the <app name> Info.plist file of the Xcode project:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsLocalNetworking</key>
  <true/>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
1
2
3
4
5
6
7

Implementation method to display advertisement with higher unit price than

By displaying advertisements after several tens of seconds from the ad ready event, we may increase unit price. This is because, when requesting a plurality of advertisements at the same time to prepare the first advertisement, the application side is notified of the preparation completion, and there is a possibility that the advertisement with a higher unit price becomes ready in a few seconds thereafter That is why. Therefore, by receiving the advertisement acquisition process in advance, it is possible to acquire a higher unit price advertisement.

Last Updated: 6/22/2020, 1:40:07 PM