Prerequisites

  • iOS 9 or later.
  • Xcode 14 or later.
  • Application Id provided in Admost Mediation Dashboard.
  • Zone Id(s) provided in Admost Mediation Dashboard.

For testing you can use following Ids;

Markup
 markupCopyApplication Id: @"15066ddc-9c18-492c-8185-bea7e4c7f88c"
Banner Zone Id: @"b4009772-de04-42c4-bbaa-c18da9e4a1ab"
Interstitial Zone Id: @"39f74377-5682-436a-9338-9d1c4df410bd"
RewardedVideo Zone Id: @"2bdefd44-5269-4cbc-b93a-373b74a2f067"
Offerwall Zone Id: @"1cadca08-33f9-4da7-969e-ef116d4e7d0e"

Ad Networks

Ad Network

SDK Version

Adapter Version

Header Bidding

Changelog

Supported Ad Types
BannerInterstitialRewardedOfferwallOpen AdsRewarded Interstitial
AdColony4.9.04.9.0.1Changelog
AdMob12.6.012.6.0.0Changelog
Admatic2.1.62.1.6.0Changelog
Admost1.6.91.6.9.0Changelog
AdServer1.1.51.1.5s.0Changelog
A4G10.6.010.6.0.0Changelog
ADX10.6.010.6.0.0Changelog
Amazon4.5.34.5.3.0Changelog
AppHarbr1.19.11.19.1.0Changelog
AppLovin13.3.113.3.1.0Changelog
Appnext1.9.31.9.3.4
Bigo4.6.04.6.0.1Changelog
Chartboost9.9.09.9.0.0Changelog
Criteo7.0.07.0.0.1Changelog
DFP10.6.010.6.0.0Changelog
Meta6.15.26.15.2.0Changelog
DTExchange8.3.78.3.7.0Changelog
HyprMX6.2.06.2.0.0
InMobi10.8.310.8.3.0Changelog
IronSource8.9.18.9.1.0Changelog
Madvertise4.1.84.1.8.0
Mintegral7.7.87.7.8.0Changelog
Mobfox4.2.24.2.2.2
MyTarget5.31.15.31.1.0Changelog
Nexage(AOL)6.8.26.8.2.2
Ogury4.2.24.2.2.0
Pollfish6.2.36.2.3.0
Pubnative2.16.02.16.0.0
Pubmatic2.6.22.6.2.0
Qumpara1.1.61.1.6.3
ReklamUp10.6.010.6.0.0Changelog
Smaato22.9.322.9.3.0Changelog
SmartAd7.24.27.24.2.0Changelog
StartApp4.10.34.10.3.0Changelog
Tapjoy13.0.113.0.1.0Changelog
Tappx4.0.94.0.9.1
Teads5.0.205.0.20.0
Pangle7.2.0.57.2.0.5Changelog
UnityAds4.15.04.15.0.0Changelog
Verizon1.14.21.14.2.0
Vrtcal2.1.02.1.0.1
Liftoff7.5.1.07.5.1.0Changelog
YandexAds7.14.17.14.1.0Changelog
YouAppi5.0.05.0.0.3

Setup

You can install AMR SDK and mediation adapters using CocoaPods (recommended) or if you want to integrate AMR SDK manually, please read the manuel integration guide.

Installation

pod version   pod platform   pod license  

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects which automates and simplifies the process of using 3rd-party libraries like AMR in your projects. See getting started guide for more information on installing cocoapods.

Create your podfile and install

At least one mediation adapter is required for AMRSDK to show banners. You can add all adapters (recommended for maximized revenue) or start with a subset of adapters. Consult your AMR agent for further details.

Please click + icon to add to list and - to remove from list. Podfile will be updated while you are choosing networks.

 

To integrate AMR SDK and mediation adapters into your Xcode project using CocoaPods, specify it in your Podfile:

Copysource 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!

target 'MyAwesomeTarget' do
#core SDK
pod 'AMRSDK', '~> 1.5'
#mediation adapters

end

Then, run the following command:

Markup
 markupCopy$ pod install

SKAdNetwork

With the iOS 14, you need to add SKAdNetwork ids to your Info.plist file to support conversion tracking.

Add following code to your Info.plist file:

CopyPLEASE SELECT ONE OR MORE NETWORKS TO CREATE YOUR SKADNETWORK LIST.

After you complete pod installation you can skip to Xcode Setup step.

Xcode Setup

Add following lines to your plist file.

Markup
 markupCopy<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>admost.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>
Markup
 markupCopy<key>NSCalendarsUsageDescription</key>
<string>Some ad content may access calendar</string>
New iOS 14

Starting with iOS 14, apps will be required to ask users for permission to access IDFA. In order to ask for this permission and display the App Tracking Transparency authorization request for accessing the IDFA, you will need to add NSUserTrackingUsageDescription key to Info.plist file.

Markup
 markupCopy<key>NSUserTrackingUsageDescription</key>
<string>Your awesome message to encourage user to give permission to access IDFA</string>
                    

To present the authorization request, call requestTrackingAuthorizationWithCompletionHandler:

Objective-C
 objectivecCopy#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>

...
if (@available(iOS 14.5, *)) {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        + (void)updateATTStatus {
            [AMRAnalytics checkVersionUpdate];
        }
        // Tracking authorization completed.
    }];
}
Swift
 swiftCopyimport AppTrackingTransparency
import AdSupport
...
if #available(iOS 14.5, *) {
    ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
        AMRSDK.updateATTStatus()
        // Tracking authorization completed.
    })
}

User is prompted with following popup after requestTrackingAuthorizationWithCompletionHandler call.

att-iOS.png

Please see ATTrackingManager.AuthorizationStatus for possible return values.

Usage

Initialization

To initialize Admost Mediation SDK, import AMRSDK.h to your AppDelegate file;

Objective-C
 objectivecCopy#import <AMRSDK/AMRSDK.h>
Swift
 swiftCopyimport AMRSDK

and initialize AMRSDK with your Application Id in didFinishLaunchingWithOptions callback;

Objective-C
 objectivecCopy- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
                            
    //Privacy COMPLIANCE
    [AMRSDK setUserConsent:YES];
    [AMRSDK subjectToGDPR:NO];
    [AMRSDK subjectToCCPA:NO];
                            
    [AMRSDK startWithAppId:@"<appId>"];
                            
        return YES;
}
Swift
 swiftCopyfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
                        
    //GDPR COMPLIANCE
    AMRSDK.setUserConsent(true)
    AMRSDK.subject(toGDPR: false)
    AMRSDK.subject(toCCPA: false)
                        
    AMRSDK.start(withAppId:"<appId>")
                        
        return true
}

For testing you can use following Application Id;

Markup
 markupCopyApplication Id: @"15066ddc-9c18-492c-8185-bea7e4c7f88c"

COPPA

You can use following method, if you want to show age-restricted ads;

Objective-C
 objectivecCopy[AMRSDK setUserChild:YES];
Swift
 swiftCopyAMRSDK.setUserChild(true)

GDPR and CCPA

Once you have collected the user’s consent, you can pass it onto the SDK using the init configuration parameters shown above.

setUserConsent has a boolean parameter. If you have the user’s consent, set it YES. If you do not have the user's consent, set it NO.

subjectToGDPR has a boolean parameter. If you know the user is subject to GDPR, set it YES. If you know the user is not subject to GDPR, set it NO.

subjectToCCPA has a boolean parameter. If you know the user is subject to CCPA, set it YES. If you know the user is not subject to CCPA, set it NO.

If you don’t pass the user’s consent or subjectToGDPR to the SDK, the rules described in GDPR have been applied.

If you don’t pass the user’s consent or subjectToCCPA to the SDK, the rules described in CCPA have been applied.

Important Default banner size changed from Fullscreen width to 320x50, 728x90 and 300x250.
If you are using 320x90 banner, please contact with your account manager.

There are 3 types of banner size; 320x50, 728x90 and 300x250 banner.

To create and show a banner ad first import AMRSDK.h to your UIViewController file and declare an AMRBanner *mpuBanner property;

Objective-C
 objectivecCopy// ViewController.h
                            
#import <AMRSDK/AMRSDK.h>
                            
@interface ViewController : UIViewController <AMRBannerDelegate>
                            
@property(nonatomic, strong) AMRBanner *mpuBanner;
                            
@end
Swift
 swiftCopy// ViewController
                            
import AMRSDK
                            
class ViewController : UIViewController, AMRBannerDelegate {
                            
var AMRBanner *mpuBanner!

}

Initialize it with your Banner Zone Id and set it's delegate to an object (generally your viewController) which conforms to <AMRBannerDelegate> protocol.

Objective-C
 objectivecCopy// ViewController.m
                            
mpuBanner = [AMRBanner bannerForZoneId:@"<zoneId>"];
mpuBanner.delegate = self;
Swift
 swiftCopy// ViewController
                            
mpuBanner = AMRBanner.init(forZoneId:"<zoneId>")
mpuBanner.delegate = self

For testing you can use following Banner Zone Id;

Markup
 markupCopyBanner Zone Id: @"b4009772-de04-42c4-bbaa-c18da9e4a1ab"

Optionally you can set the width of the banner, default value is 320px for 50px banner, 728px for 90px banner, 300px for 250px banner.

Objective-C
 objectivecCopympuBanner.bannerWidth = [UIScreen mainScreen].bounds.size.width;
Swift
 swiftCopympuBanner.bannerWidth = UIScreen.main.bounds.size.width

Start loading banner with loadBanner method and wait for the <AMRBannerDelegate> protocol callbacks.

Objective-C
 objectivecCopy[mpuBanner loadBanner];
Swift
 swiftCopympuBanner.load()

There are 3 callback methods in AMRBannerDelegate protocol. When didReceiveBanner callback method is called just add banner's bannerView as a subview on your viewcontroller to show banner.

Objective-C
 objectivecCopy- (void)didReceiveBanner:(AMRBanner *)banner {
    [self.view addSubview:banner.bannerView];
}
Swift
 swiftCopyfunc didReceive(_ banner: AMRBanner!) {
    self.view.addSubview(banner.bannerView)
}

If didFailToReceiveBanner callback method is called investigate error to adress the problem.

Objective-C
 objectivecCopy- (void)didFailToReceiveBanner:(AMRBanner *)banner error:(AMRError *)error {
    NSLog(error.errorDescription);
}
Swift
 swiftCopyfunc didFail(toReceive banner: AMRBanner!, error: AMRError!) {
    print(error.errorDescription)
}

New didClickBanner callback method is called when banner clicked.

Objective-C
 objectivecCopy- (void)didClickBanner:(AMRBanner *)banner {
    NSLog(@"Banner clicked.");
}
Swift
 swiftCopyfunc didClick(_ banner: AMRBanner!) {
    print("Banner clicked.")
}

Customize Native Ad Appearance (Optional)

You can change the appearance of native ads to suit your application's design. Download CustomXibs files and add them to your project.

You can change the layout and design of following assets;

shadowed image

If you want to use your own layouts you can create a copy and modify one of the custom sized samples (CustomNative150x250.xib, CustomNative200x200.xib or CustomNative300x120.xib) and change their frame to fit your design.

shadowed image

To use your own custom native xibs you have set the name and size of the custom xib explicitly as follows;

Objective-C
 objectivecCopy_bannerCustom200x200 = [AMRBanner bannerForZoneId:@"<zoneId>"];
            _bannerCustom200x200.delegate = self;
            _bannerCustom200x200.customNativeSize = CGSizeMake(200, 200);
            _bannerCustom200x200.customeNativeXibName = @"CustomNative200x200";
            [_bannerCustom200x200 loadBanner];
Swift
 swiftCopybannerCustom200x200 = AMRBanner.init(forZoneId:"<zoneId>")
            bannerCustom200x200.delegate = self
            bannerCustom200x200.customNativeSize = CGSize(width: 200.0, height: 200.0)
            bannerCustom200x200.customeNativeXibName = "CustomNative200x200"
            bannerCustom200x200.load()

Interstitial Ads

To create and show an interstitial ad first import AMRSDK to your UIViewController file and declare an AMRInterstitial property;

Objective-C
 objectivecCopy// ViewController.h
                            
#import <AMRSDK/AMRSDK.h>
                            
@interface ViewController : UIViewController <AMRInterstitialDelegate>
                            
@property(nonatomic, strong) AMRInterstitial *fullScreen;
                            
@end
Swift
 swiftCopy// ViewController
                            
import AMRSDK
                            
class ViewController : UIViewController, AMRInterstitialDelegate {
                            
var fullScreen: AMRInterstitial!
                            
}

Initialize it with your Interstitial Zone Id and set it's delegate to an object (generally your viewController) which conforms to AMRInterstitialDelegate protocol.

Objective-C
 objectivecCopy// ViewController.m
                            
fullScreen = [AMRInterstitial interstitialForZoneId:@"<zoneId>"];
fullScreen.delegate = self;
[fullScreen loadInterstitial];
Swift
 swiftCopy// ViewController
                            
fullScreen = AMRInterstitial(forZoneId:"<zoneId>")
fullScreen.delegate = self
fullScreen.load()

For testing you can use following Interstitial Zone Id;

Markup
 markupCopyInterstitial Zone Id: @"39f74377-5682-436a-9338-9d1c4df410bd"

There are 6 callback methods in AMRInterstitialDelegate protocol. When didReceiveInterstitial callback method is called just call the showFromViewController method to present interstitial from a viewController.

Objective-C
 objectivecCopy- (void)didReceiveInterstitial:(AMRInterstitial *)interstitial {
    [interstitial showFromViewController:self];
}
Swift
 swiftCopyfunc didReceive(_ interstitial: AMRInterstitial!) {
    interstitial.show(from: self.navigationController)
}

If didFailToReceiveInterstitial callback method is called investigate error to adress the problem.

Important Attempting to load a new interstitial from the didFailToReceiveInterstitial methods is strongly discouraged.

Objective-C
 objectivecCopy- (void)didFailToReceiveInterstitial:(AMRInterstitial *)interstitial error:(AMRError *)error {
    NSLog(error.errorDescription);
}
Swift
 swiftCopyfunc didFail(toReceive interstitial: AMRInterstitial!, error: AMRError!) {
    print(error.errorDescription)
}

didShowInterstitial callback method is called to inform the application that the received interstital is shown.

Objective-C
 objectivecCopy- (void)didShowInterstitial:(AMRInterstitial *)interstitial {}
Swift
 swiftCopyfunc didShow(_ interstitial: AMRInterstitial!) {}

didFailToShowInterstitial callback method is called to inform the application that the received interstitial failed to be shown. This delegate expected to be called very rarely but if it is called you should either load another interstitial or resume tasks.

Objective-C
 objectivecCopy- (void)didFailToShowInterstitial:(AMRInterstitial *)interstitial error:(AMRError *)error {}
Swift
 swiftCopyfunc didFail(toShow interstitial: AMRInterstitial!, error: AMRError!) {}

New didClickInterstitial callback method is called when interstital clicked.

Objective-C
 objectivecCopy- (void)didClickInterstitial:(AMRInterstitial *)interstitial {}
Swift
 swiftCopyfunc didClick(_ interstitial: AMRInterstitial!) {}

didDismissInterstitial callback method is called to inform the application that the interstitial is closed by clicking cross button/back button. You can use this callback to resume paused tasks during interstitial presentation.

You can use didDismissInterstitial callback and reload a interstitial ad.

Objective-C
 objectivecCopy- (void)didDismissInterstitial:(AMRInterstitial *)interstitial {}
Swift
 swiftCopyfunc didDismiss(_ interstitial: AMRInterstitial!) {}

You can use showFromViewController: method to present interstitial from a viewController.

Objective-C
 objectivecCopy[interstitial showFromViewController:self];
Swift
 swiftCopyinterstitial.show(from: self)

You can use tag functionality for interstitial zones. Tags will let you monitor the performance of the ads across different dimensions for the same zone. You can switch ads on and off for any specified tag whenever you want. Example usage is as follows;

Objective-C
 objectivecCopy[interstitial showFromViewController:self withTag:@"game_start"];
Swift
 swiftCopyinterstitial.show(from: self, withTag: "game_start")

Rewarded Video Ads

Rewarded video ads' integration is pretty similar to Interstitial ads with 2 additional callbacks. To create and show a rewarded video ad first import AMRSDK to your UIViewController file and declare an AMRRewardedVideo property;

Objective-C
 objectivecCopy// ViewController.h
                                
#import <AMRSDK/AMRSDK.h>
                                
@interface ViewController : UIViewController <AMRRewardedVideoDelegate>
                                
@property(nonatomic, strong) AMRRewardedVideo *rewardedVideo;
                                
@end
Swift
 swiftCopy// ViewController
                                
import AMRSDK
                                
class ViewController : UIViewController, AMRRewardedVideoDelegate {
                                
var rewardedVideo: AMRRewardedVideo!
                                
}

Initialize it with your RewardedVideo Zone Id and set it's delegate to an object (generally your viewController) which conforms to AMRRewardedVideoDelegate protocol.

Objective-C
 objectivecCopy// ViewController.m
                            
rewardedVideo = [AMRRewardedVideo rewardedVideoForZoneId:@"<zoneId>"];
rewardedVideo.delegate = self;
[rewardedVideo loadRewardedVideo];
Swift
 swiftCopy// ViewController
                            
rewardedVideo = AMRRewardedVideo(forZoneId: "<zoneId>")
rewardedVideo.delegate = self
rewardedVideo.load()

For testing you can use following RewardedVideo Zone Id;

Markup
 markupCopyRewardedVideo Zone Id: @"2bdefd44-5269-4cbc-b93a-373b74a2f067"

There are 7 callback methods in AMRRewardedVideoDelegate protocol.

When didReceiveRewardedVideo callback method is called just call the showFromViewController method to present rewarded video from a viewController.

Objective-C
 objectivecCopy- (void)didReceiveRewardedVideo:(AMRRewardedVideo *)rewardedVideo {
    [rewardedVideo showFromViewController:self];
}
Swift
 swiftCopyfunc didReceive(_ rewardedVideo: AMRRewardedVideo!) {
    rewardedVideo.show(from: self)
}

If didFailToReceiveRewardedVideo callback method is called investigate error to adress the problem.

Important Attempting to load a new rewarded video from the didFailToReceiveRewardedVideo methods is strongly discouraged.

Objective-C
 objectivecCopy- (void)didFailToReceiveRewardedVideo:(AMRRewardedVideo *)rewardedVideo error:(AMRError *)error {
            NSLog(error.errorDescription);
        }
Swift
 swiftCopyfunc didFail(toReceive rewardedVideo: AMRRewardedVideo!, error: AMRError!) {
            print(error.errorDescription);
        }

didShowRewardedVideo callback method is called to inform the application that the received rewarded video is shown.

Objective-C
 objectivecCopy- (void)didShowRewardedVideo:(AMRRewardedVideo *)rewardedVideo {}
Swift
 swiftCopyfunc didShow(_ rewardedVideo: AMRRewardedVideo!) {}

didFailToShowRewardedVideo callback method is called to inform the application that the received rewarded video failed to be shown. This delegate expected to be called very rarely but if it is called you should either load another rewarded video or resume tasks.

Objective-C
 objectivecCopy- (void)didFailToShowRewardedVideo:(AMRRewardedVideo *)rewardedVideo error:(AMRError *)error {}
Swift
 swiftCopyfunc didFail(toShow rewardedVideo: AMRRewardedVideo!, error: AMRError!) {}

New didClickRewardedVideo callback method when rewarded video clicked.

Objective-C
 objectivecCopy- (void)didClickRewardedVideo:(AMRRewardedVideo *)rewardedVideo {}
Swift
 swiftCopyfunc didClick(_ rewardedVideo: AMRRewardedVideo!) {}

didCompleteRewardedVideo callback method is called to inform the application that the user completed watching the video to a certain point to get the reward. The video may have finished or keep playing after didCompleteRewardedVideo is called. Use this callback to reward the user.

Important Attempting to load a new rewarded video from the didCompleteRewardedVideo methods is strongly discouraged.

Objective-C
 objectivecCopy- (void)didCompleteRewardedVideo:(AMRRewardedVideo *)rewardedVideo {
            [player reward];
        }
Swift
 swiftCopyfunc didComplete(_ rewardedVideo: AMRRewardedVideo!) {
            player.reward()
        }

didDismissRewardedVideo callback method is called to inform the application that the rewarded video is closed by clicking cross button/back button. You can use this callback to resume paused tasks during rewarded video presentation.

You can use didDismissRewardedVideo callback and reload a new rewarded video ad.

Objective-C
 objectivecCopy- (void)didDismissRewardedVideo:(AMRRewardedVideo *)rewardedVideo {
                    [animation resume];
                }
Swift
 swiftCopyfunc didDismiss(_ rewardedVideo: AMRRewardedVideo!) {
                    animation.resume()
                }

You can use showFromViewController: method to present rewarded video from a viewController.

Objective-C
 objectivecCopy[rewardedVideo showFromViewController:self];
Swift
 swiftCopyrewardedVideo.show(from: self)

You can use tag functionality for rewarded video zones. Tags will let you monitor the performance of the ads across different dimensions for the same zone. You can switch ads on and off for any specified tag whenever you want. Example usage is as follows;

Objective-C
 objectivecCopy[rewardedVideo showFromViewController:self withTag:@"game_start"];
Swift
 swiftCopyrewardedVideo.show(from: self, withTag: "game_start")

Offerwall Ads

To create and show an offerwall ad first import AMRSDK to your UIViewController file and declare an AMROfferWall property;

Objective-C
 objectivecCopy// ViewController.h
                                            
                #import <AMRSDK/AMRSDK.h>
                                            
                @interface ViewController : UIViewController <AMROfferWallDelegate>
                                            
                @property(nonatomic, strong) AMROfferWall *fullScreen;
                                            
                @end
Swift
 swiftCopy// ViewController
                                            
                import AMRSDK
                                            
                class ViewController : UIViewController, AMROfferWallDelegate {
                                            
                var fullScreen: AMROfferWall!
                                            
                }

Initialize it with your Offerwall Zone Id and set it's delegate to an object (generally your viewController) which conforms to AMROfferWallDelegate protocol.

Objective-C
 objectivecCopy// ViewController.m
                                                
                    fullScreen = [AMROfferWall offerWallForZoneId:@"<zoneId>"];
                    fullScreen.delegate = self;
                    [fullScreen loadOfferWall];
Swift
 swiftCopy// ViewController
                                                
                    offerWall = AMROfferWall(forZoneId: "<zoneId>")
                    offerWall.delegate = self
                    offerWall.load()

For testing you can use following Offerwall Zone Id;

Markup
 markupCopyOfferwall Zone Id: @"1cadca08-33f9-4da7-969e-ef116d4e7d0e"

There are 5 callback methods in AMROfferWallDelegate protocol. When didReceiveOfferWall callback method is called just call the showFromViewController method to present offerwall from a viewController.

Objective-C
 objectivecCopy- (void)didReceiveOfferWall:(AMROfferWall *)offerwall {
                            [offerwall showFromViewController:self];
                        }
Swift
 swiftCopyfunc didReceive(_ offerwall: AMROfferWall!) {
                            offerWall.show(from: self)
                        }

If didFailToReceiveOfferWall callback method is called investigate error to adress the problem.

Objective-C
 objectivecCopy- (void)didFailToReceiveOfferWall:(AMROfferWall *)offerwall error:(AMRError *)error {
                                NSLog(error.errorDescription);
                            }
Swift
 swiftCopyfunc didFail(toReceive offerwall: AMROfferWall!, error: AMRError!) {
                                print(error.errorDescription)
                            }

didShowOfferWall callback method is called to inform the application that the received offerwall is presented.

Objective-C
 objectivecCopy- (void)didShowOfferWall:(AMROfferWall *)offerwall {}
Swift
 swiftCopyfunc didShow(_ offerwall: AMROfferWall!) {}

didFailToShowOfferWall callback method is called to inform the application that the received offerwall failed to be presented. This delegate expected to be called very rarely but if it is called you should either load another offerwall or resume tasks.

Objective-C
 objectivecCopy- (void)didFailToShowOfferWall:(AMROfferWall *)offerwall error:(AMRError *)error {}
Swift
 swiftCopyfunc didFail(toShow offerwall: AMROfferWall!, error: AMRError!) {}

didDismissOfferWall callback method is called to inform the application that the offerwall is no longer present. You can use this callback to resume paused tasks during offerwall presentation.

Objective-C
 objectivecCopy- (void)didDismissOfferWall:(AMROfferWall *)offerwall {}
Swift
 swiftCopyfunc didDismiss(_ offerwall: AMROfferWall!) {}

Spend Virtual Currency

Objective-C
 objectivecCopy                                            // Spend Virtual Currency Callbacks - Optional
                                            [AMRSDK setVirtualCurrencyDelegate:self];
                                            [AMRSDK spendVirtualCurrency];
                                                        
                                            - (void)didSpendVirtualCurrency:(NSString *)currency
                                                        amount:(NSNumber *)amount
                                                    networkName:(NSString *)networkName {}
                                        
Swift
 swiftCopy// Spend Virtual Currency Callbacks - Optional
                                        AMRSDK.setVirtualCurrencyDelegate(self)
                                        AMRSDK.spendVirtualCurrency()
                                                    
                                        func didSpendVirtualCurrency(_ currency: String!, amount: NSNumber!, networkName: String!) {}

Extras

DFP/AdMob Mediation Integration

The AMR DFP Adapter lets publishers integrate Admost Mediation Router ads into applications with DFP or AdMob Mediation set as main ad mediation layer.

In order to show AMR ads in DFP/AdMob Mediation you should first follow dedicated steps of DFP or AdMob Mediation to set AMR as an ad mediation source.

After adding AMR as an ad mediation source you should define class names for banner, interstitial, rewarded video and Rewarded Interstitial ad custom events. Enter the AMRAdapterDFP.AMRDFPCustomEvent as class name. You must pass your AMR zone Id to custom event via Parameter field.

shadowed image

Include Admost DFP Adapter in your project after setup, if you are using CocoaPods add following line to your podfile and run the following command to install.

Markup
 markupCopypod AMRAdapterDFP
Markup
 markupCopy$ pod install

Now you can show AMR banner, interstitial and rewarded video ads via DFP or AdMob Mediation.

You can check DFP banner and interstitial example in demo project; AMRDemo/DFPCustomEvents/DFPCustomEventsViewController.m

Test Suite

You can use Test Suite to test your ad networks with your zone ids.

To use Test Suite in your application, you can use one of the following codes;

Objective-C
 objectivecCopy[AMRSDK startTestSuiteWithAppId:@"<appId>"];
[AMRSDK startTestSuiteWithZones:@[<zoneIds>]];
Swift
 swiftCopyAMRSDK.startTestSuite(withAppId:"<appId>")
AMRSDK.startTestSuite(withZones:[<zoneIds>]];
shadowed image

In App Purchase Tracking

The following method is used to track purchases with receipt validation:

Objective-C
 objectivecCopy[AMRSDK trackIAP:@"<transactionId>"
currencyCode:@"<currencyCode>"
amount:<amount>
tags:@[tags]];
Swift
 swiftCopyAMRSDK.trackIAP("<transactionId>",
currencyCode:"<currencyCode>",
amount:<amount>,
tags:[tags])

Explanation of Parameters:

  • transactionId – Transaction identifier of SKPaymentTransaction.
  • currencyCode – Currency code of transaction.
  • amount – Amount of transaction.
  • tags – Distinction value for in-app purchase that used in multiple purposes.

Example code for in app purchase tracking:

Objective-C
 objectivecCopySKProduct *product = ...;
NSLocale *priceLocale = product.priceLocale;
NSString *currencyCode = [priceLocale objectForKey:NSLocaleCurrencyCode];
                            
[AMRSDK trackIAP:transaction.transactionIdentifier
                 currencyCode:currencyCode
                 amount:[product.price doubleValue]
                 tags:@[tags]];
Swift
 swiftCopylet product: SKProduct = ...;
let currencyCode = product.priceLocale.currencyCode
                            
AMRSDK.trackIAP(transaction.transactionIdentifier,
                currencyCode:currencyCode,
                amount:product.price
                tags:[tags])

Preloading Banners

You can use cacheBanner method to cache your banners before showing them.

In order to cache banners use following code;

Objective-C
 objectivecCopyAMRBanner* banner = [AMRBanner bannerForZoneId:@"<zoneId>"];
banner.bannerWidth = 320;
[banner cacheBanner];
Swift
 swiftCopylet banner = AMRBanner.init(forZoneId:"<zoneId>")
banner.bannerWidth = 320
banner.cacheBanner()

Setting Application User Id

You can use the following method to set application specific user id in Admost Analytics for enhanced tracking of your users. You should to call this method before initialization.

Objective-C
 objectivecCopy[AMRSDK setUserId:@"<applicationUserId>"];
Swift
 swiftCopyAMRSDK.setUserId("<applicationUserId>")

Adjust Integration

Follow the official ADJUST documents to integrate AdjustSDK in to your app.

Objective-C
 objectivecCopy#import <AMRSDK/AMRSDK.h>
#import <AdjustSdk/Adjust.h>
                            
@interface AppDelegate () <AdjustDelegate> @end
                            
 - (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
                            
    [AMRSDK startWithAppId:@"<appId>"];
    .
    .
                            
    // Adjust Integration
                            
    // Replace <yourAdjustAppToken> with your Adjust app token.
    NSString *yourAppToken = @"<yourAdjustAppToken>"
                            
    // Replace environment from ADJEnvironmentSandbox to ADJEnvironmentProduction before publishing.
    NSString *environment = ADJEnvironmentSandbox;
                            
    ADJConfig *adjustConfig = [ADJConfig configWithAppToken:yourAppToken
    environment:environment];
                            
    [adjustConfig setDelegate:self];
    [Adjust appDidLaunch:adjustConfig];
    .
    .
                            
    return YES;
}
Swift
 swiftCopyimport AMRSDK
import AdjustSdk
                            
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate {
                            
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
                            
    AMRSDK.start(withAppId:"<appId>")
    .
    .
                            
    // Adjust Integration
                            
    // Replace <yourAdjustAppToken> with your Adjust app token.
    let yourAppToken = "<yourAdjustAppToken>"
                            
    // Replace environment from ADJEnvironmentSandbox to ADJEnvironmentProduction before publishing.
    let environment = ADJEnvironmentSandbox
                            
    let adjustConfig = ADJConfig(appToken: yourAppToken, environment: environment)
    adjustConfig?.delegate = self
                            
    Adjust.appDidLaunch(adjustConfig)
    .
    .
                            
    return true
}

Important Replace environment from <ADJEnvironmentSandbox> to <ADJEnvironmentProduction> before publishing.

Important Replace <yourAdjustAppToken> with your own Adjust app token. You can find this in your Adjust dashboard.

Your Adjust app token can be found on Adjust Dashboard -> Apps -> App Detail.

adjust_app_token.png

AppsFlyer Integration

Follow the official APPSFLYER documents to integrate AppsFlyerSDK in to your app.

Server to Server Callbacks

For rewarded video ads, you can use Server to Server Callbacks for rewarding users after successful completion of video ads. Please consult your business contact person for enabling it and setting required parameters like callback URL, request verification token and method.
To use this feature, only requirement on application side is setting your application user id as described here. You may also add new custom parameters to the callback URL by setting custom data to the rewarded video object AMRRewardedVideo as shown in the sample code below. This method has to be called before showing ad.

Objective-C
 objectivecCopyrewardedVideo.customData = @{
                            @"ip": @"127.0.0.1",
                            @"os": @"12.0.1"
                            };
Swift
 swiftCopyrewardedVideo.customData = [
                            "ip": "127.0.0.1",
                            "os": "12.0.1"
                            ]

You may also set ssvServerKey parameter to decide SSV Server.

Objective-C
 objectivecCopyrewardedVideo.ssvServerKey = @"test_server";
Swift
 swiftCopyrewardedVideo.ssvServerKey = "test_server"

Privacy Consent Required

You can optionally use isPrivacyConsentRequired method to obtain the user is in a GDPR or CCPA required country.

Objective-C
 objectivecCopy[AMRSDK isPrivacyConsentRequired:^(AMRPrivacyConsentStatus consentStatus) {}];
Swift
 swiftCopyAMRSDK.isPrivacyConsentRequired { (consentStatus) in}

Apple App Privacy

Starting December 8, 2020, Apple has announced a privacy disclosure for the App Store, You must define which data are collected by your apps and any SDKs you have integrated. To improve the performance of AdMost, the AMRSDK may collect following information from your apps:

  • User ID – If you are using setUserId method to identify users with your custom app user ID, you will need to select 'User ID'
  • Purchases – If you are using in app purchase trackings methods, you will need to select 'Purchases'
  • Coarse Location – To estimate the general location of a device
  • Product Interaction – Analytics purposes
  • Advertising Data – Analytics purposes

Remote Config

Admost Remote config is a feature for defining and updating server side parameters from the Admost dashboard. You can define the parameters in long, double, boolean and string types. Example usage is as follows;

Objective-C
 objectivecCopy/* it is required to call value functions after Admost initialization
    otherwise default value will be used. */
[AMRSDK fetchRemoteConfigWithCompletion:^(AMRError * _Nonnull) {
    [AMRSDK getConfigForKey:@""].stringValue;
    [AMRSDK getConfigForKey:@""].numberValue;
    [AMRSDK getConfigForKey:@""].boolValue;
 }];
Swift
 swiftCopy/* it is required to call value functions after Admost initialization
    otherwise default value will be used. */
AMRSDK.fetchRemoteConfigWithCompletion(completionHandler:(AMRError) -> Void) {
    AMRSDK.getConfigForKey("").stringValue;
    AMRSDK.getConfigForKey("").numberValue;
    AMRSDK.getConfigForKey("").boolValue;
}

You can also run A/B tests for remote config parameters with or without bundling other test parameters. You do not have to do anything to run or join these tests on client side, random percentile targeting feature of the sdk will handle it itself. You can define these tests and target your audiences from the dashboard's A/B test menu.

CMP(Consent Management Platform) Integration

Starting January 16, 2024 Publishers and developers using Google AdSense, Ad Manager, or AdMob will be required to use a Consent Management Platform (CMP) that has been certified by Google and has integrated with the IAB's Transparency and Consent Framework (TCF) when serving ads to users in the European Economic Area or the UK. You can also review the official documentation to integrate it into your app.

As Admost, we have integration with Google’s CMP tool User Messaging Platform (UMP). As a publisher, if you chose to continue with the UMP, you have to be sure about the following steps;

  • Add UMP SDK into your app and complete the integration according to the UMP integration documentation.
  • Create a proper GDPR message for your app on the UMP dashboard.
  • Select all active ad networks and "Admost" as Vendor on the UMP dashboard.
  • Check Auto UMP Detection checkbox on Admost dashboard application edit popup.

Example usage is as follows;

Objective-C
 objectivecCopy#include <UserMessagingPlatform/UserMessagingPlatform.h>
Swift
 swiftCopyimport UserMessagingPlatform
Objective-C
 objectivecCopy__weak __typeof__(self) weakSelf = self;

UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
parameters.tagForUnderAgeOfConsent = NO;

[UMPConsentInformation.sharedInstance requestConsentInfoUpdateWithParameters:parameters completionHandler:^(NSError *_Nullable requestConsentError) {
    if (requestConsentError) {
        NSLog(@"Error: %@", requestConsentError.localizedDescription);
        return;
    }
    
    __strong __typeof__(self) strongSelf = weakSelf;
    if (!strongSelf) {
        return;
    }
    
    [UMPConsentForm loadAndPresentIfRequiredFromViewController:strongSelf
        completionHandler:^(NSError *loadAndPresentError) {
            if (loadAndPresentError) {
            NSLog(@"Error: %@", loadAndPresentError.localizedDescription);
            return;
            }
            // Consent has been gathered.
        }];
    
    [AMRSDK canRequestAds: [UMPConsentInformation sharedInstance].canRequestAds];
}];
Swift
 swiftCopylet parameters = UMPRequestParameters()
parameters.tagForUnderAgeOfConsent = false
    
UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(with: parameters) { requestConsentError in
    if (requestConsentError != nil) { 
        print("Error: \(requestConsentError)")
        return
    }
    
    UMPConsentForm.loadAndPresentIfRequired(from: self) { loadAndPresentError in
        if (loadAndPresentError != nil) {
            print("Error: \(loadAndPresentError)")
            return
        }
        // Consent has been gathered.
    }
    
    AMRSDK.canRequestAds(UMPConsentInformation.sharedInstance.canRequestAds)
}