Skip to main content

Rewarded Ads

Rewarded ads are full-screened image or video ads that rewards users for viewing the ad.

Implementing View Controller

In the view controller that will present the ad view as subview,

  • add this property

    GFPRewardedAdManager *adManager

  • and implement this delegate protocol

    GFPRewardedAdManagerDelegate

// MyViewController.h

@import GFPSDK;

@interface MyViewController : UIViewController <GFPRewardedAdManagerDelegate>

@property (nonatomic) GFPRewardedAdManager *adManager;

@end

GFPRewardedAdManager

Initializing GFPRewardedAdManager

Initialize GFPRewardedAdManager in your view controller, say, in viewDidLoad:.

  • Provide GFPRewardedAdManager with video ad Ad Unit ID (essential) as registered on GFP dashboard, UIView to enclose video view, and GFPAdParam (optional) for better ad performance.

  • Set GFPRewardedAdManagerDelegate to GFPRewardedAdManager

danger

Use GFPRewardedAdManager instance for only single ad request, than create another for the next ad request. It is designed to manage the life cycle of only single ad.

- (void)viewDidLoad {
[super viewDidLoad];

GFPAdParam *adParam = [[GFPAdParam alloc]init];
adParam.yearOfBirth = 1990;
adParam.gender = GFPAdParamGenderTypeMale;
...

self.adManager = [[GFPRewardedAdManager alloc] initWithUnitID:@"UnitID" adParam:adParam];
self.adManager.delegate = self;
self.adManager.requestTimeoutInterval = 60;
}

Loading Ad

danger

Since AppLovin and IronSource runs on a singleton to for loading ads, you can preload only one ad at a time, per Ad Unit ID.

[self.adManager load];

Showing Ad

On succefully loading ad, GFPRewardedAdManagerDelegates provides ad through rewardedAdManager:didLoadAd:.

Than show the rewarded ad at the desired moment, using GFPRewardedAdManager show:

Loaded ads don't have to be shown as soon as being loaded. Thus, preload ads for app's performance.

Be mindful, though, that loaded ads are valid for a only limited time. ex) for DFP, FAN: 60 mins.

[self.adManager show:self];

Resuming Video Ad

For S2S rewarded video ads, if rewarded ad's viewController is presented by super-viewController's present: method, the video is paused by default.

Video must be resumed manually through the GFPRewardedAdMananger by,

[GFPRewardedAdManager resumeCurrentRewardVideo];

Additional Configurations

Ad Request Timeout (per GFPRewardedAdManager)

Set timeout (seconds) for ad requests. GFPInterstitialAdManager will call rewardedAdManager:didFailWithError:responseInfo: on timeout. Default is 60 seconds.

self.adManager.requestTimeoutInterval = ...

Ad Request Timeout (global configuration on GFPAdManager)

Set global interstitial timeout (seconds) for ad requests. GFPRewardedAdManager will call rewardedAdManager:didFailWithError:responseInfo: on timeout. Default is 60 seconds.

[GFPAdManager adConfiguration].rewardedAdRequestTimeout = ...

GFPRewardedAdManagerDelegate

Load Events

On Load Success

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager didLoadAd:(nonnull GFPRewardedAd *)rewardedAd {
...
}

On Load Failure

rewardedAdMananger:didFailWithError emits ad load failure, show errors, valid timeout, etc.

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager didFailWithError:(nonnull GFPError *)error responseInfo:(nullable GFPLoadResponseInfo *)responseInfo {
...
}

LifeCycle Events

On Start Showing Ad

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager didStartAd:(nonnull GFPRewardedAd *)rewardedAd {
...
}

On Rewarding

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager didCompleteAd:(nonnull GFPRewardedAd *)rewardedAd withReward:(nullable GFPReward *)reward {
...
}

FAN and some ad networks does not emit GFPReward, thus, nil is returned instead.

On Dismiss

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager didCloseAd:(nonnull GFPRewardedAd *)rewardedAd {
...
}


On Click

- (void)rewardedAdManager:(nonnull GFPRewardedAdManager *)manager wasClickedAd:(nonnull GFPRewardedAd *)rewardedAd {
...
}

info

For Google DFP = 7.X.X click events are not supported.