Skip to content

Rewarded Video Ads

Rewarded ads let you offer users in-app items—such as continued gameplay, virtual currency, or other rewards—in exchange for their engagement with ads. Rewarded ads boost engagement because users receive a tangible benefit for their time.

The following sections show you how to load and then show a rewarded ad.

Load an ad

To load a rewarded ad, instantiate an CTRewardedVideoAd object that corresponds to your ad unit and call its loadAd method

objc
#import <CartySDK/CartySDK.h>

self.rewardedVideoAd = [[CTRewardedVideoAd alloc] init];
self.rewardedVideoAd.placementid = @"<your-placement-id>";
self.rewardedVideoAd.delegate = self;
[self.rewardedVideoAd loadAd];
swift
import CartySDK

rewardedVideoAd = CTRewardedVideoAd()
rewardedVideoAd.placementid = "<your-placement-id>"
rewardedVideoAd.delegate = self
rewardedVideoAd.load()

Register for Callbacks

Implement CTRewardedVideoAdDelegate to listen to ad events.

objc
- (void)CTRewardedVideoAdDidLoad:(nonnull CTRewardedVideoAd *)ad { 
    NSLog(@"Ad loaded");
}

- (void)CTRewardedVideoAdLoadFail:(nonnull CTRewardedVideoAd *)ad withError:(nonnull NSError *)error { 
    NSLog(@"Ad load fail: %@",error.localizedDescription);
}

- (void)CTRewardedVideoAdDidShow:(nonnull CTRewardedVideoAd *)ad { 
    NSLog(@"Ad did show");
}

- (void)CTRewardedVideoAdShowFail:(nonnull CTRewardedVideoAd *)ad withError:(nonnull NSError *)error { 
    NSLog(@"Ad show fail: %@",error.localizedDescription);
}

- (void)CTRewardedVideoAdDidClick:(nonnull CTRewardedVideoAd *)ad {
    NSLog(@"Ad did click");
}

- (void)CTRewardedVideoAdDidDismiss:(nonnull CTRewardedVideoAd *)ad {
    NSLog(@"Ad did close");
}

- (void)CTRewardedVideoAdDidEarnReward:(nonnull CTRewardedVideoAd *)ad rewardInfo:(nonnull NSDictionary *)rewardInfo {
    NSLog(@"Ad did rewarded");
}
swift
func ctRewardedVideoAdDidLoad(_ ad: CTRewardedVideoAd) {
    print("Ad loaded")
}
    
func ctRewardedVideoAdLoadFail(_ ad: CTRewardedVideoAd, withError error: any Error) {
    print("Ad load fail \(error.localizedDescription)")
}
    
func ctRewardedVideoAdDidShow(_ ad: CTRewardedVideoAd) {
    print("Ad did show")
}
    
func ctRewardedVideoAdShowFail(_ ad: CTRewardedVideoAd, withError error: any Error) {
    print("Ad show fail \(error.localizedDescription)")
}
    
func ctRewardedVideoAdDidClick(_ ad: CTRewardedVideoAd) {
    print("Ad did click")
}
    
func ctRewardedVideoAdDidDismiss(_ ad: CTRewardedVideoAd) {
    print("Ad did close")
}
    
func ctRewardedVideoAdDidEarnReward(_ ad: CTRewardedVideoAd, rewardInfo: [AnyHashable : Any]) {
    print("Ad did Reward")
}

Display the ad

To show an rewarded ad, call showAd on the CTRewardedVideoAd object that you instantiated:

objc
if(self.rewardedVideoAd.isReady)
{
    [self.rewardedVideoAd showAd:self];
}
swift
if(rewardedVideoAd.isReady())
{
    rewardedVideoAd.show(self)
}

Other

Mute

Make sure make this call before load

objc
self.rewardedVideoAd.isMute = YES;
swift
rewardedVideoAd.isMute = true

Client-side bidding

After the ad loads successfully, you can obtain ecpm via the following API.

objc
self.rewardedVideoAd.ecpm
swift
rewardedVideoAd.ecpm

After winning the ad bid, call bidWin and pass in the second-highest bid from this bid.

objc
[self.rewardedVideoAd bidWin:@"second_pirce"];
swift
rewardedVideoAd.bidWin("second_pirce");

After an ad is lost, bidWin is called with the highest bid received in the auction.

objc
[self.rewardedVideoAd bidLoss:@"top_price"];
swift
rewardedVideoAd.bidLoss("top_price")

Server-to-Server (S2S) Reward

Examples on GitHub