Integrating Growth Action [iOS]
Follow
Getting Started
DFINERY Growth Action provides functions to help customers engage with their engagement marketing activities.
[Learn about the Growth Action service]
Using the functions provided by DFINERY, you can create audience groups and conduct personalized marketing targeting each audience.
[[Quote:Guide:Normal]] To use Growth Action, you must use the DFINERY paid plan.[ Contact Us ]
Push Service Default Settings
Certificate Registration
Register the certificate to use the iOS Growth Action Service.
Register in the Definery Console / Growth Action / Settings / iOS Push Setting.
[[Quote:Warning:Normal]]
Please make sure to check.
- You must register a p12 certificate without a password.
- The p12 certificate must be registered as a Production type.
- iOS Gross Action Server Push works only in the Production environment.- iOS Growth Action Server Push works only in the Production environment.
Add Capability
Complete the following tasks to integrate the iOS Growth Action service.
- Add Background Modes and Push Notifications to the app's Signing & Capabilities -> Capability
- Check Remote notifications in Background Modes
Add framework
Complete the following items to use the iOS Growth Action service.
- Add NotificationCenter.framework and UserNotifications.framework in the General section.
Add Notification Service Extension
Add a Notification Service Extension to use Growth Action in iOS.
a. Click the '+' button at the bottom of Xcode
b. Select Notification Service Extension and click the Next button
c. Enter the Product Name and complete
d. Add AdBrixRmKit.xcframework to the General settings of the relevant Extension.
The framework is located in the Pods -> AdBrixRmKit folder of the current project.
e. Once the extension setup is complete, open the automatically added NotificationService file in the folder and modify it as follows.
//NotificationService.swift import UserNotifications import AdBrixRmKit class NotificationService : AdBrixPushService {}
//NotificationService.h #import <UserNotifications/UserNotifications.h> #import <AdBrixRmKit/AdBrixPushServiceObjC.h> @interface NotificationService : AdBrixPushServiceObjC @end //NotificationService.m #import "NotificationService.h" @implementation NotificationService
@end
Set Token Value
To use the iOS Growth Action service, add and modify the AppDelegate with the following content.
a. Retrieve Device Token value
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data){ //This is an example to check the registered push token value. let token = deviceToken.map {String(format: "%02.2hhx", $0)}.joined()
print(token)
//Integrate the push token as follows. let adBrix = AdBrixRM.getInstance adBrix.setRegistrationId(deviceToken: deviceToken) }
/- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
//This is an example to check the registered push token value. const unsigned char *data = (const unsigned char *)[deviceToken bytes];
NSMutableString *token = [NSMutableString string];
for (NSUInteger i = 0; i < [deviceToken length]; i++) {
[token appendFormat:"%02.hhX", data[i]];
}
NSLog(@"%@", token);
//Integrate the push token as follows. AdBrixRM * adBrix = [AdBrixRM sharedInstance];
[adBrix setRegistrationIdWithDeviceToken:deviceToken]; }
Push notification settings
a. Add push On/Off feature according to user notification permission consent in didFinishLaunchingWithOptions
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { ...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
application.registerForRemoteNotifications()
let unCenter = UNUserNotificationCenter.current() unCenter.delegate = self let options : UNAuthorizationOptions = [.alert,.sound,.badge] unCenter.requestAuthorization(options: options, completionHandler: {(granted,error) in if granted {
DispatchQueue.main.async {
// If Push permission is granted enable AdBrix Push AdBrixRM.getInstance.setPushEnable(toPushEnable: true) application.registerForRemoteNotifications() } } else {
// If Push permission is not granted disable AdBrix Push AdBrixRM.getInstance.setPushEnable(toPushEnable: false)
} }) ... }
//AppDelegate.h #import <UIKit/UIKit.h> #import <UserNotifications/UNUserNotificationCenter.h> @interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate> @end //AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
... [application registerForRemoteNotifications]; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){ if(granted) {
[[UIApplication sharedApplication] registerForRemoteNotifications]; AdBrixRM * adBrix = [AdBrixRM sharedInstance]; [adBrix setPushEnableToPushEnable:true];
} else {
AdBrixRM * adBrix = [AdBrixRM sharedInstance]; [adBrix setPushEnableToPushEnable:false];
} }]; ... }
[[Quote:Warning:Normal]]
Check Default Settings
The default setting for the definery is 'Push off'.
Therefore, after completing the integration with the growth action, you must call the setPushEnable(toPushEnable: Bool) API after obtaining push reception consent from users. Please call it by passing true as the value for toPushEnable: Bool.
Existing users who have already consented to receive push notifications must also call the setPushEnable() API to receive push notifications.
b. Foreground Notification Settings
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if let apsInfo = notification.request.content.userInfo["aps"] as? [String : Any] { if let genWhileRun = apsInfo["gen_while_run"] as? Bool, genWhileRun == true { completionHandler([.alert, .sound]) } } completionHandler([]) }
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { NSDictionary *apsInfo = notification.request.content.userInfo[@"aps"]; if (apsInfo != nil) { NSNumber *genWhileRun = apsInfo[@"gen_while_run"]; if (genWhileRun.intValue == 1) { completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound); return; } } completionHandler(UNNotificationPresentationOptionNone); }
c. Add push click tracking function
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { AdBrixRM.getInstance.userNotificationCenter(center: center, response: response) completionHandler() }
- (void) userNotificationCenter:(UNUserNotificationCenter )center didReceiveNotificationResponse:(UNNotificationResponse )response withCompletionHandler:(void (^)(void))completionHandler{ AdBrixRM * adBrix =[AdBrixRM sharedInstance]; [adBrix userNotificationCenterWithCenter:center response:response]; completionHandler(); }
Notification subscription and opt-out settings
In order to integrating the DFINERY Growth Action feature, you need to set up a subscription for notifications. The SDK allows subscription and opt-out settings not only for push notifications but also for other channels, and it also provides the functionality to retrieve the current settings.
Subscribe and Unsubscribe Notifications
Set the users notification consent value with the DFINERY server.
-
Related API Information
- SubscriptionStatus.Builder
-
Set SubscriptionStatus using SubscriptionStatus.Builder().build()
- setInformativeNotificationFlag() : Set consent for receiving informative notifications
- setMarketingNotificationFlag() : Set consent for receiving marketing notifications
- setMarketingNotificationFlagForPushChannel() : Marketing notifications (Push channel)
- setMarketingNotificationFlagForSmsChannel() : Marketing notifications (SMS channel)
- setMarketingNotificationFlagForKakaoChannel() : Marketing notifications (KakaoTalk channel)
- setMarketingNotificationAtNightFlag() : Set consent for receiving marketing notifications at night
- setMarketingNotificationAtNightFlagForPushChannel() : Night marketing notifications (Push channel)
- setMarketingNotificationAtNightFlagForSmsChannel() : Night marketing notifications (SMS channel)
- setMarketingNotificationAtNightFlagForKakaoChannel() : Night marketing notifications (KakaoTalk channel)
-
SubscriptionStatus._Type
- SUBSCRIBED : Consent
- UNSUBSCRIBED : Rejection
- UNDEFINED : Default value not set (This value is for get API type and will not be applied even if set.)
-
SetSubscriptionResult
- isSuccess: Bool - Whether server communication was successful
- resultCode: Int? - Result code provided by the server
- resultMessage: String? - Result message provided by the server
- AdBrixRM.setSubscription(status: SubscriptionStatus, completion: @escaping (SetSubscriptionResult) -> ())
[[Quote:Warning:Normal]]
Check Default Settings
If the login(userId:) API is used without being called, only informational notifications can be used, and it will be classified as a device-based audience. To use user-based audiences and promotional notifications, the login(userId:) call must be made first.
- Sample Code
// Set only the necessary flags. Values not set are delivered to the server with .UNDEFINED.
let status = SubscriptionStatus.Builder()
.setInformativeNotificationFlag(to: .SUBSCRIBED)
.setMarketingNotificationFlag(to: .UNSUBSCRIBED)
.setMarketingNotificationFlagForKakaoChannel(to: .UNSUBSCRIBED)
.setMarketingNotificationFlagForSmsChannel(to: .SUBSCRIBED)
.setMarketingNotificationFlagForPushChannel(to: .UNSUBSCRIBED)
.setMarketingNotificationAtNightFlag(to: .UNSUBSCRIBED)
.setMarketingNotificationAtNightFlagForSmsChannel(to: .UNSUBSCRIBED)
.setMarketingNotificationAtNightFlagForKakaoChannel(to: .UNSUBSCRIBED)
.setMarketingNotificationAtNightFlagForPushChannel(to: .UNSUBSCRIBED)
.build()
AdBrixRM.getInstance.setSubscriptionStatus(status: status) { result in
if result.isSuccess {
print("success")
} else {
print(result.resultMessage)
print(result.resultCode)
}
}
AdBrixRM *adBrix = [AdBrixRM sharedInstance];
SubscriptionStatusBuilder *builder = [SubscriptionStatus Builder];
[[[builder setInformativeNotificationFlagTo: _TypeSUBSCRIBED]
setMarketingNotificationFlagTo: _TypeSUBSCRIBED]
setMarketingNotificationFlagForPushChannelTo:_TypeSUBSCRIBED]
setMarketingNotificationAtNightFlagTo:_TypeUNSUBSCRIBED];
SubscriptionStatus *status = [builder build];
[adBrix setSubscriptionStatusWithStatus:status completion:^(SetSubscriptionResult *result) {
if (result.isSuccess) {
NSLog(@"success");
} else {
NSLog(result.resultMessage);
NSLog(result.resultCode);
}
}];
[[Quote:Risk:Moderate]]
Notice
If the flag is not set
, it will be managed on the server with the default value of
UNDEFINED
. In this case, to prevent the push from not being sent due to an unset flag, the server will process the push as
SENT
like SUBSCRIBED. Therefore, if you do not want the push to be sent, please explicitly set the flag to UNSUBSCRIBED.
[[Citation:Risk:Moderate]]
Precautions
Consent to receive informational notifications is treated as a
higher concept
than consent to receive promotional notifications. Therefore, if the informational flag is UNSUBSCRIBED, the push will not be sent even if the promotional flag is SUBSCRIBED.
Get notification subscription information
The currently set notification subscription information is retrieved from the DFINERY server.
-
Related API Information
-
SubscriptionStatus
- informativeNotificationFlag : Consent value for receiving informational notifications
- marketingNotificationFlag : Consent value for receiving marketing notifications
- marketingNotificationFlagForPushChannel : Consent for receiving marketing notifications (Push Channel)
- marketingNotificationFlagForSmsChannel : Consent for receiving marketing notifications (SMS Channel)
- marketingNotificationFlagForKakaoChannel : Consent for receiving marketing notifications (KakaoTalk Channel)
- marketingNotificationAtNightFlag : Consent value for receiving nighttime marketing notifications
- marketingNotificationAtNightFlagForPushChannel : Consent for receiving nighttime marketing notifications (Push Channel)
- marketingNotificationAtNightFlagForSmsChannel : Consent for receiving nighttime marketing notifications (SMS Channel)
- marketingNotificationAtNightFlagForKakaoChannel : Consent for receiving nighttime marketing notifications (KakaoTalk Channel)
-
SubscriptionStatus._Type
- SUBSCRIBED : Agreed
- UNSUBSCRIBED : Refused
- UNDEFINED : Default value not set
-
GetSubscriptionResult
- isSuccess: Bool - Whether server communication was successful
- value: SubscriptionStatus? - Object with consent values set if server communication was successful
- resultCode: Int? - Result code provided by the server
- resultMessage: String? - Result message provided by the server
- getSubscriptionStatus(completion: @escaping (GetSubscriptionResult) -> ())
-
SubscriptionStatus
- Sample Code
[[Citation:Risk:Moderate]]
Precautions
Both the getSubscriptionStatus and setSubscriptionStatus APIs function correctly only when the userId is stored on the server through the AdBrixRM.login API.
Additionally, before setting the subscription status, you must turn on the push settings using the setPushEnable(toPushEnable: Bool) API.
[[인용:안내:보통]]
Congratulations!!!
The basic integration for the Definery Growth Action service has been completed.
You can now use the server push service. Please refer to the following information to set up KakaoTalk push and SMS push message options.
Additional Push Service Settings
KakaoTalk Settings
This is the setting for using Kakao Notification Talk and Friend Talk. * KAKAOID: The 10-digit Kakao ID received through the Kakao Sync API
AdBrixRm.getInstance.setKakaoId(kakaoId: "KAKAOID") { result in if result.isSuccess { print("success")
//If the format of kakaoId is incorrect, isSuccess will be false. } else { print(result.resultCode)
print(result.resultMessage) } }
[[AdBrixRM sharedInstance] setKakaoIdWithKakaoId:@"kakaoId"
completion:^(SetCiProfileResult * result) { if (result.isSuccess) { NSLog(@"success");
//If the format of kakaoId is incorrect, isSuccess will be false. } else { NSLog(@"%@", result.resultCode);
NSLog(@"%@", result.resultMessage); } }];
[[Quote:Warning:Small]] This API can be used after logging in.
SMS Settings
This is the setting for SMS usage. *PHONE_NUMBER : Value excluding "+" from country code + number compliant with E.164 (Example: 8210********)
AdBrixRm.getInstance.setPhoneNumber(number: "PHONE_NUMBER") { result in if result.isSuccess { print("success")
//If the format of the number is incorrect, isSuccess becomes false. } else { print(result.resultCode)
print(result.resultMessage) } }
[[AdBrixRM sharedInstance] setPhoneNumberWithNumber:@"PHONE_NUMBER"
completion:^(SetCiProfileResult * result) { if (result.isSuccess) { NSLog(@"success");
// If the format of the number is incorrect, isSuccess will be false. } else { NSLog(@"%@", result.resultCode);
NSLog(@"%@", result.resultMessage); } }];
[[Quote:Warning:Small]] PHONE_NUMBER : E.164 compliant national code + number excluding the "+" (e.g.: 8210********)
[[Quote:Warning:Small]] This API can be used after logging in.
Push Notification Delegate
Set up delegates for local and server push notifications.
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, AdBrixRmPushLocalDelegate, AdBrixRmPushRemoteDelegate { ... func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { ... // Create AdBrixRM Instance let adBrix = AdBrixRM.getInstance // SDK init must call first adBrix.initAdBrix(appKey: "your_app_key", secretKey: "your_secret_key") adBrix.setAdBrixRmPushLocalDelegate(delegate: self) // Local Push Delegate adBrix.setAdBrixRmPushRemoteDelegate(delegate: self) // Reomte Push Delegate ... } // Local Push Delegate func pushLocalCallback(data: Dictionary<String, Any>?, state: UIApplication.State) { print("Local Push Received") } // Reomte Push Delegate func pushRemoteCallback(data: Dictionary<String, Any>?, state: UIApplication.State) { print("Remote Push Received") } ... }
//AppDelegate.h #import <UIKit/UIKit.h> #import <UserNotifications/UNUserNotificationCenter.h> #import <AdBrixRmKit/AdBrixRmKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate,AdBrixRmPushRemoteDelegate,AdBrixRmPushLocalDelegate> @end //AppDelegate.m - (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { ... // Create AdBrixRM Instance AdBrixRM *adBrix = [AdBrixRM sharedInstance]; // SDK init must call first [adBrix initAdBrixWithAppKey:"your_app_key" secretKey:"your_secret_key"]; [adBrix setAdBrixRmPushLocalDelegateWithDelegate:self]; // Local Push Delegate [adBrix setAdBrixRmPushRemoteDelegateWithDelegate:self]; // Reomte Push Delegate ... } // Local Push Delegate - (void)pushLocalCallbackWithData:(NSDictionary _Nullable)data state:(UIApplicationState)state { printf(“Local push Received”); } // Reomte Push Delegate - (void)pushRemoteCallbackWithData:(NSDictionary _Nullable)data state:(UIApplicationState)state { printf(“Remote push Received”); }
[[Quote:Risk:Moderate]] Each delegate operates when the app is in the foreground by clicking push.
[[Citation: Danger: Medium]]
Notice
In the case of server push delegate (pushRemoteCallback), if you select simple AppOpen during push setup, no value will be delivered. Therefore, please handle this exception.
[[Caution: Risk: Moderate]]
Precautions
Each push delegate must be called after SDK init.
Local Push Settings
Local push call
Implementing local push directly called by the client.
@IBAction func localPushEvent(_ sender: Any) { let calendar = Calendar.current let alarmTime = calendar.date(byAdding: .second, value: 5, to: Date()) let notisound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "mySound.aiff")) AdBrixRM.getInstance.registerLocalPushNotification(id: "12345", date: alarmTime!, title: "this is Title", subtitle: "this is subtitle", body: "This is text", sound: notisound, categoryId: nil, threadId: nil, badgeNumber: 3, image:URL(string: "https://myURL.com/myImage.jpg"), attrDic: ["customKey" : "customValue"], completionHandler: {(isRegSucc,error,pushid)in print("registerLocalPushnotification is RegSucc:: \(isRegSucc) : \(pushid)") }) }
- (IBAction)localPush:(id)sender { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDate *alarmTime = [calendar dateByAddingUnit:NSCalendarUnitSecond value:5 toDate:[NSDate date] options:0]; UNNotificationSound *notisound = [UNNotificationSound soundNamed:"mySound.aiff"]; NSDictionary *myAttrDic = [NSDictionary dictionaryWithObjectsAndKeys:"cutomValue1","customKey1", nil]; NSURL *myImage = [NSURL URLWithString:"https://myURL.com/myImage.jpg"]; NSNumber *badgeNumber = [NSNumber numberWithInt:3]; AdBrixRM * adBrix =[AdBrixRM sharedInstance]; [adBrix registerLocalPushNotificationWithId:"12345" date:alarmTime title:"this is Title" subtitle:"this is subtitle" body:"this is Text" sound:notisound categoryId:nil threadId:nil badgeNumber:badgeNumber image:myImage attrDic:myAttrDic completionHandler: ^(BOOL response, NSError *_Nullable error, NSString *pushId) { printf("registerLocalPushnotification :: \(response) : \(pushID)"); }]; }
Property Value
- id : unique ID for push registration
- date : Push Notification Date
- title : Title (Topmost)
- subtitle : Subtitle (below the title)
- body : main body
- sound : Push notification sound (use default sound if nil)
- categoryId : Category ID
- threadId : thread ID
- badgeNumber : Badge number displayed on the app icon
- image: Server or local image to be used for push (If it is a server image, be sure to use https://)
- attrDic : Dictionary data to be used separately
-
completionHandler: Push registration callback listener
- isRegSucc : Push registration completion status
- error : Error content when push registration fails (data is nil upon success)
- pushId : Registered push ID
Local Push Control
Used for management and control of the currently set local push.
//Current Local Push List AdBrixRM.getInstance.getRegisteredLocalPushNotification(completeHandler: {(idArr) in print(“myLocalPushList : \(idArr)“) }) // Cancel the certain Local Push let arr : Array = ["pushid1"] AdBrixRM.getInstance.cancelLocalPushNotification(ids: arr) // Cancel all Local Push AdBrixRM.getInstance.cancelLocalPushNotificationAll()
>AdBrixRM * adBrix =[AdBrixRM sharedInstance]; //Current Local Push List [adBrix getRegisteredLocalPushNotificationWithCompleteHandler:^(NSArray *idArr){ printf(“myLocalPushList :: \(idArr)“); }]; //Cancel the certain Local Push NSArray *arr = [NSArray arrayWithObjects : @“pushid1”,nil]; [adBrix cancelLocalPushNotificationWithIds:arr]; //Cancel all Local Push [adBrix cancelLocalPushNotificationAll];
- getRegisteredLocalPushNotification : Call the currently scheduled local push list
- cancelLocalPushNotification : Cancel local push call with specific push ID
- cancelLocalPushNotificationAll : Cancel all local push calls
In-app message service settings
Default settings
DFINERY in-app messages do not require separate integration.
[[Quote:Warning:Normal]] The app must be in the foregroundActive state with UIScene connected.
In-app messages can be exposed by triggering events delivered through the DFINERY SDK, and all settings can be made in the DFINERY console.
[[Quote:Information:General]] The in-app messaging feature can be used in DFINERY iOS SDK version 2.0.0.1 or higher.
Set click event delegate
The users in-app message click event is delivered through the configured event delegate.
You can define additional actions for the click event using this delegate.
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, AdBrixRMInAppMessageClickDelegate{ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let adBrix = AdBrixRM.getInstance // Add InAppMessage Click Delegate adBrix.setInAppMessageClickDelegate(delegate: self) return true } func onReceiveInAppMessageClick(actionId : String, actionType : String, actionArg : String, isClosed : Bool) { NSLog("inAppMessageDelegate actionId : \(actionId)") NSLog("inAppMessageDelegate actionType : \(actionType)") NSLog("inAppMessageDelegate actionArg : \(actionArg)") NSLog("inAppMessageDelegate isClosed : \(isClosed)") } }
>//AppDelegate.h #import <UIKit/UIKit.h> #import <UserNotifications/UNUserNotificationCenter.h> #import <AdBrixRM/AdBrixRM-Swift.h> @interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate,AdBrixRMInAppMessageClickDelegate> @end //AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AdBrixRM * adBrix = [AdBrixRM sharedInstance]; // Add InAppMessage ClickDelegate [adBrix setInAppMessageClickDelegateWithDelegate:self]; } - (void)onReceiveInAppMessageClickWithActionId:(NSString *)actionId actionType:(NSString *)actionType actionArg:(NSString *)actionArg isClosed:(BOOL)isClosed { NSString *logMessageActionId =@"inAppMessageDelegate actionId :"; logMessageActionId = [logMessageActionId stringByAppendingString: actionId]; NSLog(@"%@", logMessageActionId); NSString *logMessageActionType =@"inAppMessageDelegate actionType :"; logMessageActionType = [logMessageActionType stringByAppendingString: actionType]; NSLog(@"%@", logMessageActionType); NSString *logMessageActionArg =@"inAppMessageDelegate actionArg :"; logMessageActionArg = [logMessageActionArg stringByAppendingString: actionArg]; NSLog(@"%@", logMessageActionArg); NSString *logMessageIsClosed =@"inAppMessageDelegate isClosed :"; NSString *isClosedString = @"FALSE"; if(isClosed) { isClosedString = @"TRUE"; } logMessageIsClosed = [logMessageIsClosed stringByAppendingString: isClosedString]; NSLog(@"%@", logMessageIsClosed); }
Click Event Delegate Argument Details
The type and example of the value passed through the delegate are as follows.
- actionId (String) : button_1, button_2, image, sticky
- actionType (String) : close, deeplink_and_close, weblink, weblink_and_close, dont_show_me_today_and_close
- actionArg (String) : weblink address, deeplink path
- isClosed (Boolean) : Whether the in-app message is closed.
Using Self-Serve In-App Messages
What is a Self-Serve In-App Message?
Self-Serve in-app messages refer to in-app messages that are opened by the user fetching the data directly, unlike in-app messages triggered by events occurring in the SDK.
Guide
-
getSelfServeInAppMessages(completion: @escaping ([SelfServeInAppMessage]) ->())
- Fetch self-serve in-app messages.
-
openInAppMessage(campaignId: String, completion: @escaping (Completion) -> ())
- Displays the in-app message corresponding to the campaignId.
-
SelfServeInAppMessage
- campaignId: String. This is the campaign id.
- extAttr: [String: Any?]. These are additional settings values set in the console.
Example of use
func openSelfServeInAppMessage() { let adbrix = AdBrixRM.getInstance adbrix.getSelfServeInAppMessages { selfServeInAppMessages in for message in selfServeInAppMessages { if message.extAttr["key"] as! String == "value" { adbrix.openInAppMessage(campaignId: message.campaignId) { openResult in switch openResult { case .success: print("success") case .fail: print("fail") } } } } } }
- (void)openSelfServeInAppMessage { AdBrixRM *adbrix = [AdBrixRM getInstance]; [adbrix getSelfServeInAppMessages:^(NSArray *selfServeInAppMessages) { for (NSDictionary *message in selfServeInAppMessages) { if ([[message[@"extAttr"] objectForKey:@"key"] isEqualToString:@"value"]) { [adbrix openInAppMessageWithCampaignId:message[@"campaignId"] completion:^(OpenResult openResult) { switch (openResult) { case OpenResultSuccess: NSLog(@"success"); break; case OpenResultFail: NSLog(@"fail"); break; } }]; } } }]; }