POKKT SDK Integration Guide v8.2.0 iOS
Overview
Thank you for choosing Pokkt SDK for iOS. This document contains all the information required to set up the SDK with your project.
Downloaded SDK package will contain.
Pokkt Documents
Sample App using PokktSDK
SDK Integration
The Pokkt-Ads is installed using CocoaPods. To do this, add the following line to your Podfile. Refer to the below Example 1.
pod 'Pokkt-Ads'

Then from the command line run:
pod install
Configuring App Transport Security (ATS)
Add the NSAllowsArbitraryLoads to your app's Info.plist file to disable ATS restrictions. As per the Apple guideline, the below code is required to allow a non-secure network, and the default value is false. For additional details click here.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Adding Your Application to Your Pokkt Publisher's Account
• Create Account and log-in at http://www.pokkt.com
• Add your application and get its application Id and Security key.


• Create Screen Ids to be used in AdMob dashboard to set ad source.
This one parameter is accepted by almost all API’s of Pokkt SDK. This controls the placement of ads and can be created on Pokkt Dashboard.
Developer needs to create screens in the Pokkt Developer account.

Implementation Steps
Set Application Id and Security key in Pokkt SDK. You can get it from the Pokkt dashboard from your account. We generally assign a unique application-id and security-key.
First Import the PokktSDK and its delegate PokktAdDelegate and implement their methods to your project.
Objective C
Swift
#import <PokktSDK/PokktAds.h>
import PokktSDK
UIViewController <PokktAdDelegate>
class ViewController: UIViewController, PokktAdDelegate
This must be called before calling any other methods of Pokkt SDK.
Objective C
Swift
[PokktAds setPokktConfigWithAppId:appId securityKey:securityKey];
PokktAds.setPokktConfigWithAppId(appId, securityKey: securityKey)
Full-Screen Ads
We will be referencing the PokktAdsDemo app provided with SDK during the course of explanation in this document. We suggest you go through the sample app for better understanding.
To cache Full-screen ad call below method
Objective C
Swift
[PokktAds cacheAd:screenId withDelegate:self];
PokktAds.cacheAd(screenId, with: self)
To Show FullScreen ad call the below method
Objective C
Swift
[PokktAds showAd:screenId withDelegate:self presentingVC:self];
PokktAds.showAd(screenId, with: self, presentingVC: self)
You can check if an ad is available, before making a show request.
Objective C
Swift
[PokktAds isAdCached:screenId];
PokktAds.isAdCached(ScreenId)
Banner Ads
Add Banner to view and Load banner Ad call
Objective C
Swift
Create property
@property(nonatomic,retain) UIView *bannerAd;
CGRect adSize = CGRectMake(0, 100, [UIScreen mainScreen].bounds.size.width, 50);
self.bannerAd = [[UIView alloc] initWithFrame:adSize];
[self.view addSubview:self.bannerAd];
Create property
@IBOutlet weak var bannerView: UIView!
PokktAds.showAd(screenId, with: self, inContainer: self.bannerView)
To show banner ad, call the below method
Objective C
Swift
[PokktAds showAd:screenId withDelegate:self inContainer:self.bannerAd];
PokktAds.showAd(screenId, with: self, inContainer: self.bannerAd)
Refresh banner: You can set a banner refresh rate on the Pokkt dashboard. Refresh rate should be in range of 30 -100
Destroy banner
Objective C
Swift
[PokktAds dismissAd: screenId];
PokktAds.dismissAd(screenId)
Ad actions are optional, but we suggest implementing them as it will help you to keep track of the status of your ad request.
Objective C
Swift
/** Caching **/
- (void)adCachingResult:(NSString *)screenId
isSuccess:(BOOL)success withReward:(double)reward
errorMessage:(NSString *)errorMessage;
/** Ad Display **/
(void)adDisplayResult:(NSString *)screenId
isSuccess:(BOOL)success errorMessage:(NSString *)errorMessage;
/** Ad Closed **/
(void)adClosed:(NSString *)screenId adCompleted:(BOOL)adCompleted;
/** Ad Interaction **/
(void)adClicked:(NSString *)screenId;
(void)adGratified:(NSString *)screenId withReward:(double)reward;
/** Caching **/
- (void)adCachingResult:(NSString *)screenId isSuccess:(BOOL)success withReward:(double)reward errorMessage:(NSString *)errorMessage
/** Ad Display **/
- (void)adDisplayResult:(NSString *)screenId isSuccess:(BOOL)success errorMessage:(NSString *)errorMessage
/** Ad Closed **/
- (void)adClosed:(NSString *)screenId adCompleted:(BOOL)adCompleted
/** Ad Interaction **/
- (void)adClicked:(NSString *)screenId
- (void)adGratified:(NSString *)screenId withReward:(double)reward
Test Ads
Application Id : eee33f012ee30473abcda10c65593d97
Security Key : 0adf197193966c9f9c25485154897398
Sample Screen Id for Video : 129fda6f5d8c4f5ea7450ce8b9c94eb8
Sample Screen Id for Interstitial : 3f3d981b416864215563a7ddfecb93f2
Sample Screen Id for Banner : 07d5ffd1766b28cc9b25f99d4b0c22ea
Debugging
When your application is under development and if you want to see sdk logs and other informatory messages, you can enable it by setting setDebug to true. Make sure to disable debugging before release.
Objective C
Swift
[PokktDebugger setDebug:<YES/NO>];
[PokktDebugger exportLog:self];
PokktDebugger.setDebug(true/false)
PokktDebugger.exportLog(self)
FAQ
If you are using server to server integration with Pokkt, you can also set Third Party UserId in PokktAds.
Objective C
Swift
PokktAds.setThirdPartyUserId:(NSString*) userId;
PokktAds.setThirdPartyUserId(userId)
GDPR
If you want to set GDPR consent in Pokkt SDK. This must be called before calling any ad related API. Developers/Publishers must get the consent from the user. For more information on GDPR please refer https://www.eugdpr.org/ and https://www.eugdpr.org/gdpr-faqs.html. This API can again be used by publishers to revoke the consent. If this API is not called or invalid data provided then SDK will access the users personal data for ad targeting.
Objective C
Swift
PokktConsentInfo *consentInfo = [[PokktConsentInfo alloc] init];
consentInfo.isGDPRApplicable = true;
consentInfo.isGDPRConsentAvailable = false;
[PokktAds setPokktConsentInfo:consentInfo];
[PokktAds getPokktConsentInfo];
var consentInfo: PokktConsentInfo!
consentInfo = PokktConsentInfo()
consentInfo.isGDPRApplicable = true
consentInfo.isGDPRConsentAvailable = false
PokktAds.setPokktConsentInfo(consentInfo)
PokktAds.getPokktConsentInfo()
Extra Parameter
You can set extra parameters to POKKT SDK, to be passed back to your server via POKKT server callback. These Extra parameters will be in key-value pair.The key must be alphanumeric value. See the below example.
Objective C
Swift
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:0];
[dict setValue:@"value1" forKey:@"key1"];
[dict setValue:@"value2" forKey:@"key2"];
[dict setValue:@"value3" forKey:@"key3"];
[PokktAds setCallbackExtraParam:dict];
var dict:[String: Any]=["key1": "value1", "key2": "value2", "key3": "value3"]
PokktAds.setCallbackExtraParam(dict)
FullScreen Ads are of two types : Video and Interstitial. It can be rewarded or non rewarded. Its properties can be configured from the Pokkt dashboard. You can either cache the ad in advance or directly call show for it. We suggest you cache the ad in advance so as to give seamless play behavior, In other case it will stream the video which may lead to unnecessary buffering delays depending on the network connection.
For better targeting of ads you can also provide user details to our SDK using
Objective C
Swift
PokktUserInfo *pokktUserDetails = [PokktUserInfo alloc] init];
pokktUserDetails.name = "";
pokktUserDetails.age = "";
pokktUserDetails.sex = "";
pokktUserDetails.mobileNumber = "";
pokktUserDetails.emailAddress = "";
pokktUserDetails.location = "";
pokktUserDetails.birthday = "";
pokktUserDetails.maritalStatus = "";
pokktUserDetails.facebookId = "";
pokktUserDetails.twitterHandle = "";
pokktUserDetails.educationInformation = "";
pokktUserDetails.nationality = "";
pokktUserDetails.employmentStatus = "";
pokktUserDetails.maturityRating = "";
[PokktAds setUserDetails: pokktUserDetails];
pokktUserDetails = PokktUserInfo()
pokktUserDetails.name = ""
pokktUserDetails.age = ""
pokktUserDetails.sex = ""
pokktUserDetails.mobileNumber = ""
pokktUserDetails.location = ""
pokktUserDetails.birthday = ""
pokktUserDetails.maritalStatus = ""
pokktUserDetails.facebookId = ""
pokktUserDetails.twitterHandle = ""
pokktUserDetails.educationInformation = ""
pokktUserDetails.nationality = ""
pokktUserDetails.employmentStatus = ""
pokktUserDetails.maturityRating = ""
PokktAds.setUserDetails(pokktUserDetails)
Last updated
