Skip to content

App Open Ads

App Open ad is a type of mobile advertisement designed to appear when a user opens a mobile app. These ads are full-screen and are typically displayed in a transition moment, such as when an app is launched or brought to the foreground.

The following sections show you how to load and then show an app open ad.

Load an ad

To load an App open ad, instantiate an CTAppOpenAd object that corresponds to your ad unit and call its loadAd method

objc
#import <CartySDK/CartySDK.h>

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

openAd = CTAppOpenAd()
openAd.placementid = "<your-placement-id>"
openAd.delegate = self
openAd.load()

Register for Callbacks

Implement CTAppOpenAdDelegate to listen to ad events.

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

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

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

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

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

- (void)CTOpenAdDidDismiss:(nonnull CTAppOpenAd *)ad {
    NSLog(@"Ad did close");
}
swift
func ctOpenAdDidLoad(_ ad: CTAppOpenAd) {
    print("Ad loaded")
}
    
func ctOpenAdLoadFail(_ ad: CTAppOpenAd, withError error: any Error) {
    print("Ad load fail \(error.localizedDescription)")
}
    
func ctOpenAdDidShow(_ ad: CTAppOpenAd) {
    print("Ad did show")
}
    
func ctOpenAdShowFail(_ ad: CTAppOpenAd, withError error: any Error) {
    print("Ad show fail \(error.localizedDescription)")
}
    
func ctOpenAdDidClick(_ ad: CTAppOpenAd) {
    print("Ad did click")
}
    
func ctOpenAdDidDismiss(_ ad: CTAppOpenAd) {
    print("Ad did close")
}

Display the ad

To show an App open ad, call showAd on the CTAppOpenAd object that you instantiated:

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

Other

Mute

Make sure make this call before load

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

Client-side bidding

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

objc
self.openAd.ecpm
swift
openAd.ecpm

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

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

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

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

Examples on GitHub