iOS
AdKit for ADOP: iOS¶
Setting¶
-
Add the
GADApplicationIdentifier
key to the Xcode project's Info.plist file, and add the AdMobId value (the format in ca-app-pub-XXXXX~YYYYY) as the value for the key. Also, enter ADOP APP_KEY as the value for theBidmadAppKey
key. ADOP APP_KEY can be found in Account Management > My Information > Details after logging in to ADOP Insight.
You can identify the settings from the UMP project when managing GDPR consent.
- On iOS 14 and higher, add SKAdNetwork list to the Info.plist file by referring to the Preparing for iOS 14 guide.
-
Add the followings to the CocoaPods settings of your project app:
4. Run the following to apply CocoaPod settings.
Note
Please refer to the Privacy Survey Guide for information on completing the privacy survey form when distributing your app.
How to Use¶
Test ad key in ADOP¶
Using a test ad key that ADOP issued, not AdMob, is required.
let rewardVideoUnitId: String = "29e1ef67-98d2-47b3-9fa2-9192327dd75d"
let InterstitialAdUnitId: String = "228b95a9-6f42-46d8-a40d-60f17f751eb1"
let AdaptiveBannerAdUnitId: String = "1c3e3085-333f-45af-8427-2810c26a72fc"
let AppOpenAdUnitId: String = "0ddd6401-0f19-49ee-b1f9-63e910f92e77"
Initialize AdKit¶
Perform AdKit initialization.
When performing a reset, if you are in the European and UK (EEA & UK) regions, a GDPR consent pop-up will be automatically displayed. In other regions, a reset is performed immediately.
- If your game targets the EEA & UK region, make sure your GDPR consent pop-up is set up according to the GDPR messaging guide.
import AdKit
// Commercial
AdKit.InitializeWithShowGDPRConsent(appKey: appKey, vc: self, bLog: false, gdprTestDeviceId: nil)
// GDPR EEA test mode
AdKit.InitializeWithShowGDPRConsent(appKey: appKey, vc: self, bLog: true, gdprTestDeviceId: gdprTestDeviceId)
Delivering the user's additional information can be included when a Analytics log happens, and the data is passed in JSONObject type.
let dict = Dictionary<String, Any> (dictionaryLiteral: ("level",1),("gold",100))
AdKit.SetAdditionalInfo(additionalInfo: dict)
RewardVideo type¶
Rewardedvideo type ads reward a user who watched a video for a period of time, and is able to load one ad at a time.
// RewardVideo Instance Create
var rewardVideo:RewardVideo? = nil
rewardVideo = RewardVideo.initialize(vc: self, adUnitId: rewardVideoUnitId, eventHandler: self)
// RewardVideo Load
rewardVideo?.LoadAd(adPlacementInfo: "Native-RewardVideo-Load")
// RewardVideo Show
rewardVideo?.Show(adPlacementInfo: "Native-RewardVideo-Show")
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
Interstitial type¶
Interstitial type ads use full-screen that cover the interface of game.
// Interstitial Instance Create
var interstitialAd:Interstitial? = nil
interstitialAd = Interstitial.initialize(vc: self, adUnitId: InterstitialAdUnitId, eventHandler: self)
// Interstitial Load
interstitialAd?.LoadAd(adPlacementInfo: "Native-Interstitial-Load")
// Interstitial Show
interstitialAd?.Show(adPlacementInfo: "Native-Interstitial-Show")
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
Adaptive Banner type¶
Adaptive Banner type ads are a type of rolling banner that occupies a spot on screen. You can adjust the banner position with the BannerPosition or an yPos value. If you provide yPos to adjust the banner position, the banner will be aligned at the bottom of the screen and then will move up by the yPos value you specify.
// Create AdaptiveBanner Instance
var adaptiveBanner:AdaptiveBanner? = nil
// Initialize AdaptiveBanner Instance at the Top of View
adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, bannerPosition: BannerPosition.Top, eventHandler: self)
// Initialize AdaptiveBanner Instance at the Bottom of View
adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, bannerPosition: BannerPosition.Bottom, eventHandler: self)
// Load AdaptiveBanner
adaptiveBanner?.LoadAd(adPlacementInfo: "Native-AdaptiveBanner-Load")
// Destroy AdaptiveBanner
adaptiveBanner?.Destroy()
// This example shows adjusting the banner position with specifiying the yPos value.
// Banner Instance Create
var adaptiveBanner: AdaptiveBanner? = null
adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, yPos: yPos, eventHandler: self)
// Load AdaptiveBanner
adaptiveBanner?.LoadAd(adPlacementInfo: "Native-AdaptiveBanner-Load")
// The position is adjusted following the yPos value.
adaptiveBanner?.setPosition(yPosition:yPos)
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
AppOpen type ads¶
A type that exposes an ad when the app state changes from background to foreground.
// Create AppOpenAd Instance
var appOpen: AppOpen? =nil
appOpen = AppOpen.initialize(vc: self, adUnitId: AppOpenAdUnitId, eventHandler: self, adPlacementInfo: "Native-AppOpen-LoadInfo")
// Automatically load & show AppOpenAd when the app comes to the foreground
appOpen?.LoadAd(adPlacementInfo: "Native-AppOpen-LoadInfo")
// Destroy AppOpenAd
appOpen?.Destroy()
Test ads¶
It is important for advertiser not to be charged when test ad is clicked in development. If you click ads too much out of test mode, it is regarded as invalid action. Therefore, be aware not to be a target account to report.
Refer to the Google Developers to use a test ad.