RewardedVideo Ad mediation(Legacy) of Google Mobile Ads

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.
By using this feature, Google Mobile Ads's RewardedVideo will display video advertisements for each ad network with Geniee's mediation.

Preparation for implementation

Add GoogleMobileAds

Add the following to Podfile.

pod 'Google-Mobile-Ads-SDK'
1
Points to note when introducing GoogleMobileAds If you are introducing GoogleMobileAds, the application will crash if you do not include the admob or Google Ad Manager app ID information in Info.plist.
  • App ID information
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-################~##########</string>
<key>SKAdNetworkItems</key>
  <array>
    <dict>
      <key>SKAdNetworkIdentifier</key>
      <string>cstr6suwn9.skadnetwork</string>
    </dict>
  </array>
1
2
3
4
5
6
7
8
9

Add GNAdGoogleMediationAdapter

Introduce with Cocoapods(Recommend)

Add the following to Podfile.

pod 'Geniee-Google-Mediation-Adapter'
1

Introduction with manual

About manual installation procedure Download GNAdGoogleMediationAdapter.

GNAdGoogleMediationAdapter

Copy GNAdGoogleMediationAdapter.xcframework to the project by drag-and-drop.

Select the project from the navigator area, then select "TARGET" -> "General".

Add "GNAdGoogleMediationAdapter.xcframework" to "Linked Framework and Libraries".

For GNAdGoogleMediationAdapter 5.1.5 or lower, perform the following steps.

Add "GNAdGoogleMediationAdapter.framework" to "Embedded Binaries".

Common introduction contents

For GNAdGoogleMediationAdapter 5.1.6 and later versions, the following steps are unnecessary.

For GNAdGoogleMediationAdapter 5.1.5 or lower, perform the following steps.
  • Select "Pods/***.xcconfig" from the navigator area.
    Delete -framework "GoogleMobileAds" from "OTHER_LDFLAGS".
  • Select a project from the navigator area, then select "TARGETS" -> "Build Settings".
    Delete "GoogleMobileAds" from "Other Linker Flags".

Add Geniee SDK

For installation of Geniee SDK, see the start guide.

Start guide

Add SDK and adapter for each ad network

For video rewarding, it is necessary to set SDK and adapter for each ad network. Please refer to the introduction method from the link of the ad network from the following.

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

Implementation of rewarded video

By using the UnitID that set mediation on GoogleAdManager/AdMob management screen, you can display the mediated RewardedVideo ads.
For details on how to implement the RewardedVideo, please refer to the following site.

  1. AdManager (DFP)

How to implement RewardedVideo of GoogleAdManager

  1. AdMob

How to implement RewardedVideo of AdMob

Response when GoogleMobileAds Video Reward Ad is No Fill

If GoogleMobileAds's video reward fails to load, you can prevent the spill of ads by calling Geniee SDK. The implementation procedure is as follows.

Preparation for implementation

Import GNSVideoReward of Geniee SDK.

  • ObjectiveC
    Import the header file and add Delegate.

Example:ViewController.h

#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSRewardVideoAdDelegate.h>
@interface ViewController <GADRewardBasedVideoAdDelegate, GNSRewardVideoAdDelegate>
1
2
3
  • Swift
    Add a header file with the following contents.
#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSRewardVideoAdDelegate.h>
1
2

Select the project from the navigator area, then select "TARGET" -> "Build Settings".
Add path of the header file created above to "Objective-C Bridging Header".

Delegate method implementation

implementation of GNSRewardVideoAdDelegate.

  • ObjectiveC About Delegate implementation Set Delegate.
[GNSRewardVideoAd sharedInstance].delegate = self;
1

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

// Tells the delegate that the reward based video ad failed to load.
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd didFailToLoadWithError:(NSError *)error {
}

// Tells the delegate that a reward based video ad was received.
- (void)rewardVideoAdDidReceiveAd:(GNSRewardVideoAd *)rewardVideoAd
{
}

// Tells the delegate that the reward based video ad started playing.
- (void)rewardVideoAdDidStartPlaying:(GNSRewardVideoAd *)rewardVideoAd {
}

// Tells the delegate that the reward based video ad closed.
- (void)rewardVideoAdDidClose:(GNSRewardVideoAd *)rewardVideoAd {
}

// Tells the delegate that the reward based video ad has rewarded the user.
- (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
  • Swift About Delegate implementation Set Delegate.
GNSRewardVideoAd.sharedInstance().delegate = self
1

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

extension ViewController : GNSRewardVideoAdDelegate {

    // Tells the delegate that a reward based video ad was received.
    func rewardVideoAdDidReceive(_ rewardVideoAd: GNSRewardVideoAd!) {
    }
    
    // Tells the delegate that the reward based video ad has rewarded the user.
    func rewardVideoAd(_ rewardVideoAd: GNSRewardVideoAd!, didRewardUserWith reward: GNSAdReward!) {
    }
    
    // Tells the delegate that the reward based video ad failed to load.
    func rewardVideoAd(_ rewardVideoAd: GNSRewardVideoAd!, didFailToLoadWithError error: Error!) {
    }
    
    // Tells the delegate that the reward based video ad started playing.
    func rewardVideoAdDidStartPlaying(_ rewardVideoAd: GNSRewardVideoAd!) {
    }
    
    // Tells the delegate that the reward based video ad closed.
    func rewardVideoAdDidClose(_ rewardVideoAd: GNSRewardVideoAd!) {
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Load rewarded video ad

Implements the Geniee SDK Video Rewards load method if the Google Ad Manager / AdMob Load callback fails.
Specify the Zone ID in the load request.
If you want to show another movie after the completion of playback of one movie, you need to make a load request again.

  • ObjectiveC
GAMRequest *request = [GAMRequest request];
[GADRewardedAd loadWithAdUnitID:@"YOUR_UNIT_ID" request:request completionHandler:^(GADRewardedAd *ad, NSError *error) {
    self.buttonLoad.enabled = YES;
    if (error) {
        GNSRequest *request = [GNSRequest request];
        [[GNSRewardVideoAd sharedInstance] loadRequest:request withZoneID:@"YOUR_ZONE_ID"];
        return;
    }
    self.rewardedAd = ad;
    self.rewardedAd.fullScreenContentDelegate = self;
}];
1
2
3
4
5
6
7
8
9
10
11
  • Swift
let request = GAMRequest()
GADRewardedAd.load(withAdUnitID: "YOUR_UNIT_ID", request: request, completionHandler: { (ad, error) in
    if let error = error {
        let request = GNSRequest()
        GNSRewardVideoAd.sharedInstance().load(request, withZoneID: "YOUR_ZONE_ID")
        return
    }
    self.rewardedAd = ad
    self.rewardedAd?.fullScreenContentDelegate = self
})
1
2
3
4
5
6
7
8
9
10

Display rewarded video

In the order of GoogleMobileAds → Geniee SDK, check whether load is completed, and show movies by show method.
Please be sure to execute show after running GoogleMobileAds's Load.

  • ObjectiveC
if (self.rewardedAd) {
    [self.rewardedAd presentFromRootViewController:self userDidEarnRewardHandler:^ {
        GADAdReward *reward = self.rewardedAd.adReward;
        NSLog(@"ViewController: rewardedAd:userDidEarnRewardHandler type = %@, amount = %lf", reward.type, [reward.amount doubleValue]);
    }];
} else if ([[GNSRewardVideoAd sharedInstance] canShow]) {
    [[GNSRewardVideoAd sharedInstance] show:self];
}
1
2
3
4
5
6
7
8
  • Swift
if let ad = rewardedAd {
    ad.present(fromRootViewController: self, userDidEarnRewardHandler: {
        let reward = ad.adReward
        print("ViewController: rewardedAd:userDidEarnRewardHandler type = \(reward.type), amount = \(reward.amount).")
    })
} else if GNSRewardVideoAd.sharedInstance().canShow() {
    GNSRewardVideoAd.sharedInstance().show(self)
}
1
2
3
4
5
6
7
8

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.

  • ObjectiveC
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd didRewardUserWithReward:(GNSAdReward *)reward {
    NSLog(@"ViewController: Reward received type=%@, amount=%lf"
          ,reward.type
          ,[reward.amount doubleValue]);
}
1
2
3
4
5
  • Swift
func rewardVideoAd(_ rewardVideoAd: GNSRewardVideoAd!, didRewardUserWith reward: GNSAdReward!) {
    print("ViewController: Reward received type=" + reward.type + " , amount=\(reward.amount.doubleValue)")
}
1
2
3
Last Updated: 3/18/2021, 4:14:05 PM