Overriding Click Handler
NDA Module - Describes the feature that can override the click processing regarding Server to Server (hereinafter referred to as S2S) advertisements.
Override click handling settings
Landing processing settings can be separately set through the GFPAdConfiguration property or ad loader settings.
If both the configuration and loader for each ad type are set to S2SClickDelegate, it will be prioritized as follows:
- S2SClickDelegate set in each ad type loader
- S2SClickDelegate set globally in GFPAdConfiguration
If neither of them is set, the default setting will be used when landing.
When implementing the handler, the call is mandatory for whether the click was processed appropriately through GFPS2SAdLandingHandler which was passed as an argument. Billing occurs only when the exact value is provided, so please make sure to double-check. The handler must be called within the openURL() method scope.
ex) If an attempt to open was made without waiting for a response from UIApplication.shared.open, landingHandler(true) will be called immediately.
Global settings through GFPAdConfiguration when initializing SDK
- Swift
- Objective-C
var configuration = GFPAdConfiguration()
configuration.s2sClickDelegate = self;
GFPAdManager.setup(withPublisherCd: "", target:self, configuration: configuration) { error:GFPError? in
...
}
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
let landingUrl = GFPURLUtils.url(with: urlString)
let isClickProcessEnable = UIApplication.sharedApplication.canOpenURL(landingUrl)
UIApplication.shared.open(landingUrl, options: [:]) { isSuccess in
...
}
...
if (landingHandler != nil) {
landingHandler(isClickProcessEnable);
}
}
GFPAdConfiguration *configuration = [[GFPAdConfiguration alloc] init];
...
configuration.s2sClickDelegate = self;
[GFPAdManager setupWithPublisherCd:@"Publisher_Code" target: self configuration:configuration completionDelegate:^(GFPError * _Nullable error) {
NSLog(@"Setup isSdkInitialized: %@, ERROR: %@", [GFPAdManager isSdkInitialized] ? @"YES": @"NO", error);
}];
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
NSURL *landingUrl = [GFPURLUtils URLWithString: urlString];
BOOL isClickProcessEnable = [UIApplication.sharedApplication canOpenURL:landingUrl];
[UIApplication.sharedApplication openURL: landingUrl
options: @{}
completionHandler:^(BOOL success) {
...
}];
...
if (landingHandler) {
landingHandler(isClickProcessEnable);
}
}
Loader setting for each ad type
GFPAdLoader
- Swift
- Objective-C
var adLoader:GFPAdLoader;
...
adLoader.s2sClickDelegate = self;
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
UIApplication.shared.open(GFPURLUtils.url(with: urlString), options: [:]) { isSuccess in
if (landingHandler != nil) {
landingHandler(isSuccess);
}
}
}
GFPAdLoader *adLoader = ...
adLoader.s2sClickDelegate = self;
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
[UIApplication.sharedApplication openURL: [GFPURLUtils URLWithString: urlString]
options: @{}
completionHandler:^(BOOL success) {
if (landingHandler) {
landingHandler(success);
}
}];
}
GFPBannerView
- Swift
- Objective-C
var bannerView:GFPBannerView;
...
bannerView.s2sClickDelegate = self;
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
UIApplication.shared.open(GFPURLUtils.url(with: urlString), options: [:]) { isSuccess in
if (landingHandler != nil) {
landingHandler(isSuccess);
}
}
}
GFPBannerView *bannerview = ...
bannerView.s2sClickDelegate = self;
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
[UIApplication.sharedApplication openURL: [GFPURLUtils URLWithString: urlString]
options: @{}
completionHandler:^(BOOL success) {
if (landingHandler) {
landingHandler(success);
}
}];
}
GFPVideoAdManager
- Swift
- Objective-C
var videoAdManager:GFPVideoAdManager;
...
videoAdManager.s2sClickDelegate = self;
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
UIApplication.shared.open(GFPURLUtils.url(with: urlString), options: [:]) { isSuccess in
if (landingHandler != nil) {
landingHandler(isSuccess);
}
}
}
GFPVideoAdManager *videoAdManager = ...
videoAdManager.s2sClickDelegate = self;
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
[UIApplication.sharedApplication openURL: [GFPURLUtils URLWithString: urlString]
options: @{}
completionHandler:^(BOOL success) {
if (landingHandler) {
landingHandler(success);
}
}];
}
GFPVideoAdScheduleManager
- Swift
- Objective-C
var videoAdScheduleManager:GFPVideoAdScheduleManager;
...
videoAdScheduleManager.s2sClickDelegate = self;
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
UIApplication.shared.open(GFPURLUtils.url(with: urlString), options: [:]) { isSuccess in
if (landingHandler != nil) {
landingHandler(isSuccess);
}
}
}
GfpVideoAdScheduleManager *scheduleAdManager = ...
scheduleAdManager.s2sClickDelegate = self;
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
[UIApplication.sharedApplication openURL: [GFPURLUtils URLWithString: urlString]
options: @{}
completionHandler:^(BOOL success) {
if (landingHandler) {
landingHandler(success);
}
}];
}
GFPRewardedAdManager
- Swift
- Objective-C
var rewardedAdManager:GFPRewardedAdManager;
...
rewardedAdManager.s2sClickDelegate = self;
func openURL(with urlString: String!, landingHandler: GFPS2SAdLandingHandler!) {
UIApplication.shared.open(GFPURLUtils.url(with: urlString), options: [:]) { isSuccess in
if (landingHandler != nil) {
landingHandler(isSuccess);
}
}
}
GFPRewardedAdManager *rewardedManager = [[GFPRewardedAdManager alloc] initWithUnitID:@"UnitID" adParam:adParam];
rewardedManager.s2sClickDelegate = self;
- (void)openURLWith:(NSString *)urlString landingHandler:(GFPS2SAdLandingHandler)landingHandler {
[UIApplication.sharedApplication openURL: [GFPURLUtils URLWithString: urlString]
options: @{}
completionHandler:^(BOOL success) {
if (landingHandler) {
landingHandler(success);
}
}];
}