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

  • Objective-C
objc
#import <CartySDK/CartySDK.h>

self.rewardedVideoAd = [[CTRewardedVideoAd alloc] init];
self.rewardedVideoAd.placementid = @"<your-placement-id>";
self.rewardedVideoAd.delegate = self;
[self.rewardedVideoAd loadAd];
  • Swift
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.

  • Objective-C
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
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:

  • Objective-C
objc
if(self.rewardedVideoAd.isReady)
{
    [self.rewardedVideoAd showAd:self];
}
  • Swift
swift
if(rewardedVideoAd.isReady())
{
    rewardedVideoAd.show(self)
}

Other

Mute

Make sure make this call before load

  • Objective-C
objc
self.rewardedVideoAd.isMute = YES;
  • Swift
swift
rewardedVideoAd.isMute = true

Server-to-Server (S2S) Reward

Examples on GitHub