### Install React Native SDK Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Command to install the FlareLane SDK package via yarn. ```bash $ yarn add @flarelane/react-native-sdk@1.10.0 ``` -------------------------------- ### Install Flutter SDK Source: https://flarelane.com/ko/docs/sdk-integrations/flutter-sdk Run this command in the project root directory to add the FlareLane dependency. ```bash $ flutter pub add flarelane_flutter:1.10.0 ``` -------------------------------- ### Get Subscription Status Source: https://flarelane.com/ko/docs/web-sdk-reference Retrieves the current subscription status of the device via a callback. ```javascript FlareLane.getIsSubscribed((isSubscribed) => { // Do something... console.log(isSubscribed); }); ``` -------------------------------- ### Get Device ID Source: https://flarelane.com/ko/docs/mobile-sdk-reference Retrieves the unique identifier for the current device. ```Kotlin /* Params - Context context */ FlareLane.getDeviceId(this); ``` ```Java /* Params - Context context */ FlareLane.getDeviceId(this); ``` ```Swift FlareLane.getDeviceId() ``` ```Objective-C [FlareLane getDeviceId]; ``` ```Dart await FlareLane.shared.getDeviceId()) ``` ```JavaScript await FlareLane.getDeviceId() ``` -------------------------------- ### FlareLane.initWithLaunchOptions Source: https://flarelane.com/ko/docs/sdk-integrations/ios-sdk Initializes the FlareLane SDK within the application's didFinishLaunchingWithOptions method. ```APIDOC ## FlareLane.initWithLaunchOptions ### Description Initializes the FlareLane SDK. This should be called in the application's `didFinishLaunchingWithOptions` method. ### Parameters - **launchOptions** (NSDictionary/Dictionary) - The launch options provided by the system. - **projectId** (String) - Your unique FlareLane project ID. - **requestPermissionOnLaunch** (Bool) - Whether to request notification permissions immediately upon launch. ``` -------------------------------- ### Get Device ID Source: https://flarelane.com/ko/docs/web-sdk-reference Retrieves the unique FlareLane device ID. ```javascript FlareLane.getDeviceId((deviceId) => { // Do something... console.log(deviceId); }); ``` -------------------------------- ### Initialize FlareLane Web SDK Source: https://flarelane.com/ko/docs/sdk-integrations/web-sdk Add this script before the closing body tag to initialize the SDK with your unique project ID. ```html ``` -------------------------------- ### FlareLane.init Source: https://flarelane.com/ko/docs/mobile-sdk-reference Registers a device to the FlareLane project. The requestPermissionOnLaunch parameter allows requesting notification permissions upon app launch. ```APIDOC ## FlareLane.init ### Description Registers a device to the FlareLane project. If requestPermissionOnLaunch is set to true, notification permissions are requested when the app launches. ### Parameters - **context** (Context) - Required - The application context. - **projectId** (String) - Required - The unique project identifier. - **requestPermissionOnLaunch** (boolean) - Optional - Whether to request notification permissions on launch (default: true). ``` -------------------------------- ### Initialize FlareLane SDK Source: https://flarelane.com/ko/docs/sdk-integrations/android-sdk Initialize the SDK within the Application class's onCreate method using your project ID. ```kotlin import com.flarelane.FlareLane class MainApplication : Application() { override fun onCreate() { super.onCreate() // 아래 코드 추가 // 알림 권한 팝업 타이밍을 제어하려면 세 번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 FlareLane.initWithContext(this, "PROJECT_ID", true) } } ``` ```java import com.flarelane.FlareLane; public class MainApplication extends Application { @Override public void onCreate() { super.onCreate(); // 아래 코드 추가 // 알림 권한 팝업 타이밍을 제어하려면 세 번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 FlareLane.initWithContext(this, "PROJECT_ID", true); } } ``` -------------------------------- ### Initialize FlareLane SDK Source: https://flarelane.com/ko/docs/web-sdk-reference Initializes the SDK with the required project ID and optional service worker path. ```javascript FlareLane.initialize({ projectId: "", serviceWorkerPath: "/sw.js" // optional }); ``` -------------------------------- ### FlareLane.initialize Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Initializes the FlareLane SDK in your application. The project ID can be found in the FlareLane console. ```APIDOC ## FlareLane.initialize(projectId, requestPermissionOnLaunch) ### Description Initializes the FlareLane SDK. Set the second parameter to false if you wish to control the timing of the notification permission popup manually using the .subscribe() function. ### Parameters - **projectId** (string) - Required - The project ID from the FlareLane console. - **requestPermissionOnLaunch** (boolean) - Required - Whether to request notification permissions automatically on launch. ### Example ```javascript import FlareLane from '@flarelane/react-native-sdk'; FlareLane.initialize('PROJECT_ID', true); ``` ``` -------------------------------- ### Initialize FlareLane SDK Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Initialize the SDK in the main application file. Set the second parameter to false to manually control the notification permission prompt timing. ```typescript import FlareLane from '@flarelane/react-native-sdk'; // 알림 권한 팝업 타이밍을 제어하려면 2번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 FlareLane.initialize('PROJECT_ID', true); ``` -------------------------------- ### Initialize FlareLane SDK Source: https://flarelane.com/ko/docs/mobile-sdk-reference Registers the device with a FlareLane project. Use requestPermissionOnLaunch to control whether notification permissions are requested immediately upon app startup. ```Java /* Params - Context context - String projectId - boolean requestPermissionOnLaunch */ FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true) ``` ```Java /* Params - Context context - String projectId - boolean requestPermissionOnLaunch */ FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true); ``` ```Swift /* Params - launchOptions: [UIApplication.LaunchOptionsKey : Any]? - projectId: String - requestPermissionOnLaunch: Bool = true */ FlareLane.initWithLaunchOptions(launchOptions, projectId: "INPUT_YOUR_PROJECT_ID", true) ``` ```Objective-C /* Params - launchOptions:(NSDictionary * _Nullable) - projectId:(NSString * _Nonnull) - requestPermissionOnLaunch:(Bool) = YES */ [FlareLane initWithLaunchOptions:launchOptions projectId:@"INPUT_YOUR_PROJECT_ID" requestPermissionOnLaunch: YES]; ``` ```Swift /* Params - String projectId - bool? requestPermissionOnLaunch = true */ FlareLane.shared.initialize("INPUT_YOUR_PROJECT_ID", requestPermissionOnLaunch: true); ``` ```JavaScript /* Params - projectId: string - requestPermissionOnLaunch: boolean = true */ FlareLane.initialize('INPUT_YOUR_PROJECT_ID', true); ``` -------------------------------- ### 직접 만든 알림 채널 설정 Source: https://flarelane.com/ko/docs/sdk-integrations/android-notification-channel 기존에 사용 중인 알림 채널을 사용하도록 manifest.xml에 설정합니다. 이 값이 정의되면 SDK는 별도의 채널을 생성하지 않습니다. ```xml ``` -------------------------------- ### FlareLane.shared.initialize Source: https://flarelane.com/ko/docs/sdk-integrations/flutter-sdk Initializes the FlareLane SDK with your project ID. This should be called in the main function after WidgetsFlutterBinding.ensureInitialized(). ```APIDOC ## FlareLane.shared.initialize ### Description Initializes the FlareLane SDK. The project ID can be found in the FlareLane console. ### Parameters - **projectId** (String) - Required - The unique identifier for your project. - **requestPermissionOnLaunch** (bool) - Optional - Whether to request notification permissions on launch. If set to false, you must call .subscribe() manually. ``` -------------------------------- ### 기본 알림 채널명 변경 Source: https://flarelane.com/ko/docs/sdk-integrations/android-notification-channel 플레어레인이 생성한 기본 알림 채널의 이름을 변경하기 위해 strings.xml에 리소스를 추가합니다. ```xml 전체 알림 ``` -------------------------------- ### Initialize Airbridge and FlareLane in iOS Source: https://flarelane.com/ko/docs/external-integrations/airbridge Configure both SDKs within the AppDelegate to sync attribution data as FlareLane tags upon receipt. ```swift import FlareLane import Airbridge @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FlareLane.initWithLaunchOptions(launchOptions, projectId: "PROJECT_ID", requestPermissionOnLaunch: true) let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .setOnAttributionReceived({ attribution in var tags: [String: Any] = [:] if let attributedChannel = attribution["attributedChannel"] { tags["attributedChannel"] = attributedChannel } if let attributedCampaign = attribution["attributedCampaign"] { tags["attributedCampaign"] = attributedCampaign } if let attributedAdGroup = attribution["attributedAdGroup"] { tags["attributedAdGroup"] = attributedAdGroup } if let attributedAdCreative = attribution["attributedAdCreative"] { tags["attributedAdCreative"] = attributedAdCreative } if !tags.isEmpty { FlareLane.setTags(tags: tags) } }) .build() Airbridge.initializeSDK(option: option) return true } } ``` ```objective-c #import "AppDelegate.h" @import FlareLane; #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FlareLane initWithLaunchOptions:launchOptions projectId:@"PROJECT_ID" requestPermissionOnLaunch:YES]; AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_SDK_TOKEN"]; [optionBuilder setOnAttributionReceived:^(NSDictionary * attribution) { NSMutableDictionary *tags = [[NSMutableDictionary alloc] init]; if (attribution[@"attributedChannel"]) { [tags setObject:attribution[@"attributedChannel"] forKey:@"attributedChannel"]; } if (attribution[@"attributedCampaign"]) { [tags setObject:attribution[@"attributedCampaign"] forKey:@"attributedCampaign"]; } if (attribution[@"attributedAdGroup"]) { [tags setObject:attribution[@"attributedAdGroup"] forKey:@"attributedAdGroup"]; } if (attribution[@"attributedAdCreative"]) { [tags setObject:attribution[@"attributedAdCreative"] forKey:@"attributedAdCreative"]; } if (tags.count > 0) { [FlareLane setTagsWithTags:tags]; } }]; AirbridgeOption* option = [optionBuilder build]; [Airbridge initializeSDKWithOption:option]; return YES; } ``` -------------------------------- ### 이벤트 API 연동 예시 Source: https://flarelane.com/ko/docs/data-integrations/events REST API를 사용하여 서버 측에서 이벤트를 전송하는 예시입니다. API 키와 프로젝트 ID가 필요합니다. ```bash curl --request POST \ --url https://api.flarelane.com/v1/projects/PROJECT_ID/track \ --header 'Authorization: Bearer API_KEY' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data ' { "events": [ { "subjectType": "user", "subjectId": "userid1", "type": "purchase", "data": { "productId": "123", "productName": "상품명", "amount": 10000 } } ] } ' ``` -------------------------------- ### Configure Podfile for FlareLane SDK Source: https://flarelane.com/ko/docs/sdk-integrations/ios-sdk Add the FlareLane dependency to your Podfile for both the main application target and the Notification Service Extension target. ```ruby // 파일 최상단에 아래 줄을 추가하여 Dynamic Framework를 활성화합니다. use_frameworks! target 'YOUR_PROJECT_NAME' do // 아래 줄 추가 pod 'FlareLane', '1.10.1' end // 파일 최하단의 아래 줄 추가 // 앞서 입력한 Extension의 Product Name을 target 이름으로 설정합니다. target 'FlareLaneNotificationServiceExtension' do pod 'FlareLane', '1.10.1' end ``` -------------------------------- ### Initialize FlareLane SDK in Flutter Source: https://flarelane.com/ko/docs/sdk-integrations/flutter-sdk Initialize the SDK in the main.dart file. Ensure WidgetsFlutterBinding.ensureInitialized() is called before initialization. ```dart import 'package:flarelane_flutter/flarelane_flutter.dart'; void main() { // ensureInitialized() 이후 초기화 코드가 실행되도록 합니다 WidgetsFlutterBinding.ensureInitialized(); // 다음 초기화 코드 입력 // 알림 권한 팝업 타이밍을 제어하려면 2번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 FlareLane.shared.initialize("PROJECT_ID", requestPermissionOnLaunch: true); runApp(...); } ``` -------------------------------- ### manifest.json 연결 Source: https://flarelane.com/ko/docs/sdk-integrations/ios-web-push 웹사이트의 태그 내에 manifest.json 파일을 연결하기 위한 HTML 코드입니다. ```html ``` -------------------------------- ### Create AppDelegate for SwiftUI Source: https://flarelane.com/ko/docs/sdk-integrations/ios-sdk Define the AppDelegate class and adapt it to the SwiftUI App lifecycle. ```swift import UIKit class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } } ``` ```swift struct App: App { // 아래 코드 추가 @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate } ``` -------------------------------- ### 이벤트 트리거 SDK 예시 Source: https://flarelane.com/ko/docs/data-integrations/events Web SDK 또는 Mobile SDK를 사용하여 이벤트를 트리거하는 방법입니다. ```javascript FlareLane.trackEvent("test_event") ``` -------------------------------- ### Initialize FlareLane in AppDelegate Source: https://flarelane.com/ko/docs/sdk-integrations/ios-sdk Configure FlareLane initialization and register device tokens for push notifications. ```swift import FlareLane class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // 1 // 알림 권한 팝업 타이밍을 제어하려면 세 번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 FlareLane.initWithLaunchOptions(launchOptions, projectId: "PROJECT_ID", requestPermissionOnLaunch: true) } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // 2 FlareLaneAppDelegate.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken) } } ``` ```objective-c @import FlareLane; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 1 // 알림 권한 팝업 타이밍을 제어하려면 세 번째 파라미터를 false로 설정 후 적절한 시점에 .subscribe() 함수 실행 [FlareLane initWithLaunchOptions:launchOptions projectId:@"PROJECT_ID" requestPermissionOnLaunch:true]; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // 2 [[FlareLaneAppDelegate shared] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } ``` -------------------------------- ### FlareLaneJavascriptInterface 연동 Source: https://flarelane.com/ko/docs/sdk-integrations/webview-bridge 각 모바일 플랫폼의 웹뷰 설정에 FlareLaneJavascriptInterface를 추가하여 웹 SDK와 모바일 SDK 간의 통신을 활성화합니다. ```APIDOC ## FlareLaneJavascriptInterface 연동 ### 설명 웹뷰 내에서 발생하는 사용자 행동을 모바일 앱으로 전달하기 위해 각 플랫폼별 웹뷰 설정에 `FlareLaneJavascriptInterface`를 등록합니다. 브릿지 이름은 `FlareLaneJavascriptInterface.BRIDGE_NAME` 상수를 사용합니다. ### 지원 플랫폼 - Android - iOS - React Native - Flutter ### 주요 연동 함수 브릿지 설정이 완료되면 웹 SDK에서 다음 함수 호출 시 앱의 Mobile SDK 함수가 자동으로 실행됩니다: - `setUserId` - `setTags` - `trackEvent` - `setUserAttributes` ``` -------------------------------- ### FlareLane Skills 설치 명령어 Source: https://flarelane.com/ko/docs/skills 프로젝트 터미널에서 실행하여 AI 에이전트가 FlareLane과 상호작용할 수 있도록 설정합니다. ```bash npx skills add flarelane/flarelane-skills ``` -------------------------------- ### manifest.json 설정 Source: https://flarelane.com/ko/docs/sdk-integrations/ios-web-push 웹앱의 이름, 아이콘, 표시 방식을 정의하는 manifest.json 파일의 필수 구성 요소입니다. ```json { "name": "플레어레인", "icons": [{ "src": "/icon-192x192.png", "sizes": "192x192", "type": "image/png" }], "display": "fullscreen" } ``` -------------------------------- ### FlareLaneAppDelegate.shared.application Source: https://flarelane.com/ko/docs/sdk-integrations/ios-sdk Forwards device token registration to the FlareLane SDK. ```APIDOC ## FlareLaneAppDelegate.shared.application ### Description Forwards the device token received from APNs to the FlareLane SDK to enable push notifications. ### Parameters - **application** (UIApplication) - The current application instance. - **deviceToken** (Data/NSData) - The device token received from Apple Push Notification service. ``` -------------------------------- ### Configure iOS Podfile Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Add the FlareLane pod to the Notification Service Extension target in the Podfile. ```ruby // 파일 최하단의 아래 줄 추가 // 앞서 입력한 Extension의 Product Name을 target 이름으로 설정합니다. target 'FlareLaneNotificationServiceExtension' do pod 'FlareLane', '1.10.0' end ``` -------------------------------- ### Integrate Flutter WebView Bridge Source: https://flarelane.com/ko/docs/sdk-integrations/webview-bridge Set up the bridge using either webview_flutter or flutter_inappwebview packages. ```dart import 'package:webview_flutter/webview_flutter.dart'; import 'package:flarelane_flutter/adapters/webview_flutter.dart'; final controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) ..addJavaScriptChannel( FlareLaneJavascriptInterface.BRIDGE_NAME, onMessageReceived: FlareLaneJavascriptInterface.onMessageReceived(controller), ) ..setNavigationDelegate(NavigationDelegate( onPageStarted: FlareLaneJavascriptInterface.onPageStarted(controller), )); ``` ```dart import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flarelane_flutter/adapters/flutter_inappwebview.dart'; InAppWebView( initialUrlRequest: URLRequest(url: WebUri(url)), initialUserScripts: UnmodifiableListView([ ...FlareLaneJavascriptInterface.initialUserScripts, ]), onWebViewCreated: (controller) { controller.addJavaScriptHandler( handlerName: FlareLaneJavascriptInterface.BRIDGE_NAME, callback: FlareLaneJavascriptInterface.handlerCallback(controller), ); }, ); ``` -------------------------------- ### POST /v1/projects/{PROJECT_ID}/track Source: https://flarelane.com/ko/docs/data-integrations/user-attributes-tags 유저 프로필 및 태그 데이터를 대량 배치 등을 통해 주기적으로 동기화하는 API입니다. ```APIDOC ## POST /v1/projects/{PROJECT_ID}/track ### Description 유저 프로필 속성(userAttributes) 또는 커스텀 태그(tags)를 서버로 전송하여 동기화합니다. ### Method POST ### Endpoint https://api.flarelane.com/v1/projects/{PROJECT_ID}/track ### Parameters #### Path Parameters - **PROJECT_ID** (string) - Required - 프로젝트 고유 식별자 #### Request Body - **userAttributes** (array) - Optional - 유저 프로필 데이터 리스트 - **tags** (array) - Optional - 태그 데이터 리스트 ### Request Example { "userAttributes": [ { "userId": "userid1", "name": "name", "phoneNumber": "+821011112222", "email": "john@example.com", "dob": "1990-01-01", "timeZone": "Asia/Seoul", "country": "KR", "language": "ko" } ] } ``` -------------------------------- ### Set Tags Source: https://flarelane.com/ko/docs/web-sdk-reference Applies tags to the current user or device. ```javascript // SET FlareLane.setTags({ gender: "men", age: 24 }); ``` -------------------------------- ### Android SDK 연동 (Kotlin/Java) Source: https://flarelane.com/ko/docs/external-integrations/airbridge 에어브릿지 SDK 초기화 시 어트리뷰션 데이터를 수신하여 플레어레인 태그로 설정합니다. ```kotlin class MainApplication : Application() { override fun onCreate() { super.onCreate() FlareLane.initWithContext(this, "PROJECT_ID", true) val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN") .setOnAttributionReceived(object : OnAttributionResultReceiveListener { override fun onAttributionResultReceived(result: Map) { val tags = JSONObject() result["attributedChannel"]?.let { tags.put("attributedChannel", it) } result["attributedCampaign"]?.let { tags.put("attributedCampaign", it) } result["attributedAdGroup"]?.let { tags.put("attributedAdGroup", it) } result["attributedAdCreative"]?.let { tags.put("attributedAdCreative", it) } if (tags.length() > 0) { FlareLane.setTags(applicationContext, tags) } } }) .build() Airbridge.initializeSDK(this, option) } } ``` ```java public class MainApplication extends Application { @Override public void onCreate() { super.onCreate(); FlareLane.initWithContext(this, "PROJECT_ID", true); AirbridgeOption option = new AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN") .setOnAttributionReceived(new OnAttributionResultReceiveListener() { @Override public void onAttributionResultReceived(@NonNull Map result) { JSONObject tags = new JSONObject(); try { if (result.get("attributedChannel") != null) { tags.put("attributedChannel", result.get("attributedChannel")); } if (result.get("attributedCampaign") != null) { tags.put("attributedCampaign", result.get("attributedCampaign")); } if (result.get("attributedAdGroup") != null) { tags.put("attributedAdGroup", result.get("attributedAdGroup")); } if (result.get("attributedAdCreative") != null) { tags.put("attributedAdCreative", result.get("attributedAdCreative")); } if (tags.length() > 0) { FlareLane.setTags(getApplicationContext(), tags); } } catch (JSONException e) { // Handling Exception... } } }) .build(); Airbridge.initializeSDK(this, option); } } ``` -------------------------------- ### 인앱메시지 노출 트리거 연동 Source: https://flarelane.com/ko/docs/channels/in-app-message 각 트리거 시점에 displayInApp 함수를 호출하여 인앱메시지를 노출합니다. 데이터 객체를 전달하여 세부 필터링을 수행할 수 있습니다. ```javascript // 홈 화면 접속 시 다음 함수 실행 FlareLane.displayInApp("home"); // 데이터 함께 제공 시 세부 트리거 필터로 활용 가능 (특정 상품 조회 시 인앱 노출 등) FlareLane.displayInApp("view_product", { "product_id": 12345, "category": "food" }); ``` -------------------------------- ### Configure JitPack Repository Source: https://flarelane.com/ko/docs/sdk-integrations/android-sdk Add the JitPack repository to your project's dependency management configuration. ```kotlin dependencyResolutionManagement { repositories { // 아래 줄 추가 maven("https://jitpack.io") } } ``` ```groovy dependencyResolutionManagement { repositories { // 아래 줄 추가 maven { url 'https://jitpack.io' } } } ``` ```groovy allprojects { repositories { // 아래 줄 추가 maven { url 'https://jitpack.io' } } } ``` -------------------------------- ### 기본 Liquid 문법 예시 Source: https://flarelane.com/ko/docs/targets/personalized-messages 다양한 데이터 타입과 필터를 활용한 개인화 메시지 작성 예시입니다. ```liquid {{ name | default: "고객" }}님 안녕하세요! ``` ```liquid {{ tags.signup_date | date: "%Y-%m-%d", "Asia/Seoul" }} 일자로 가입이 완료되었습니다. ``` ```liquid 주문하신 {{ entry_event.data.product_name | truncate: 20 }} 상품의 배송이 시작되었습니다. ``` ```liquid 적립금 {{ tags.point | number_with_delimiter}} 원이 소멸 예정입니다. ``` -------------------------------- ### Liquid 필터 연속 활용 Source: https://flarelane.com/ko/docs/targets/personalized-messages 필터를 체이닝하여 데이터 포맷팅과 기본값 설정을 동시에 처리합니다. ```liquid {{ tags.signup_date | date: "%Y-%m-%d", "Asia/Seoul" | default: "오늘" }} 일자로 가입이 완료되었습니다. ``` -------------------------------- ### Set Tags Source: https://flarelane.com/ko/docs/mobile-sdk-reference Updates user or device tags. Use JSONObject.NULL or equivalent to remove a specific tag. ```Kotlin /* Params - Context context - JSONObject tags */ var tags = JSONObject() tags.put("gender", "men") tags.put("age", 24) tags.put("removeTag", JSONObject.NULL) // remove FlareLane.setTags(this, tags) ``` ```Java /* Params - Context context - JSONObject tags */ JSONObject tags = new JSONObject(); tags.put("gender", "men"); tags.put("age", 24); tags.put("removeTag", JSONObject.NULL); // remove FlareLane.setTags(this, tags); ``` ```Swift /* Params - tags: [String : Any] */ FlareLane.setTags(tags: ["gender": "men", "age": 24]) ``` ```Objective-C /* Params - tags:(NSDictionary * _Nonnull) */ [FlareLane setTagsWithTags:@{@"gender": @"men", @"age": @24}]; ``` ```Dart /* Params - Map tags */ FlareLane.shared.setTags({ "gender": "men", "age": 24 }); ``` ```JavaScript /* Params - tags: Record */ FlareLane.setTags({ gender: 'men', age: 27 }); ``` -------------------------------- ### POST /v1/projects/{PROJECT_ID}/track Source: https://flarelane.com/ko/docs/data-integrations/events Triggers an event for a specific user. This is the recommended method for server-side event tracking to ensure accuracy. ```APIDOC ## POST /v1/projects/{PROJECT_ID}/track ### Description Triggers an event for a specific user. This is the recommended method for server-side event tracking to ensure accuracy. ### Method POST ### Endpoint https://api.flarelane.com/v1/projects/{PROJECT_ID}/track ### Request Body - **events** (array) - Required - List of event objects - **subjectType** (string) - Required - The type of subject (e.g., "user") - **subjectId** (string) - Required - The unique identifier for the user - **type** (string) - Required - The name of the event (e.g., "purchase") - **data** (object) - Optional - Key-value pairs containing event details ### Request Example { "events": [ { "subjectType": "user", "subjectId": "userid1", "type": "purchase", "data": { "productId": "123", "productName": "상품명", "amount": 10000 } } ] } ``` -------------------------------- ### Liquid 조건 분기 및 변수 할당 Source: https://flarelane.com/ko/docs/targets/personalized-messages assign을 사용하여 변수를 정의하고 if/elsif/else 문으로 메시지 내용을 분기합니다. ```liquid {% assign user_name = tags.nickname %} {% assign last_purchase = tags.last_purchase_category %} {% if last_purchase == "스니커즈" %} 이번 주 한정으로 {{ user_name }}님이 좋아하시는 스니커즈 신상품을 10% 할인 중이에요! 놓치지 마세요 👟 {% elsif last_purchase == "아우터" %} 추운 날씨에 딱 맞는 아우터 신상이 입고되었어요! {{ user_name }}님을 위한 특별 혜택도 준비되어 있답니다 🧥 {% else %} {{ user_name }}님만을 위한 신규 상품과 할인 혜택이 준비되어 있어요. 지금 바로 확인해보세요! {% endif %} ``` -------------------------------- ### Android 매니페스트 설정 Source: https://flarelane.com/ko/docs/sdk-integrations/disable-click-url-processing manifest.xml 파일에 meta-data 태그를 추가하여 모든 알림의 URL 자동 처리를 비활성화합니다. ```xml # 1줄 코드 추가 ``` -------------------------------- ### 수신거부 웹훅 데이터 규격 Source: https://flarelane.com/ko/docs/channels/email 수신거부 리스트 변경 시 서버로 전달되는 웹훅의 JSON 데이터 구조입니다. 고객사 서버에서 이 규격에 맞춰 API를 구성해야 합니다. ```json // HTTP Method: POST { requestId: string; // UUID type:"ReportEmailUnsubscribed"; data: { projectId: string; // test-project-id userContact: string; // test@example.com subscribed: boolean; // true, false } } ``` -------------------------------- ### 개인화 변수 활용 예시 Source: https://flarelane.com/ko/docs/targets/personalized-messages 태그 및 이벤트 데이터를 메시지에 삽입하는 예시입니다. ```liquid {{ tags.grade }} 등급 쿠폰이 발급되었습니다. ``` ```liquid 고객님 장바구니에 담긴 {{ entry_event.data.product_name }} 상품이 기다리고 있어요! ``` ```liquid {{ writerName }}님이 회원님의 글을 좋아합니다. ``` -------------------------------- ### Implement UNNotificationServiceExtension Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Handles rich notification content and service extension expiration for FlareLane notifications. ```swift import UserNotifications import FlareLane class NotificationService: UNNotificationServiceExtension { override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { // 1 // 플레어레인에서 발송한 푸시는 플레어레인의 메소드만 동작하도록 분기 처리합니다. if FlareLaneNotificationServiceExtensionHelper.shared.isFlareLaneNotification(request) { FlareLaneNotificationServiceExtensionHelper.shared.didReceive(request, withContentHandler: contentHandler) } else { // ... } } override func serviceExtensionTimeWillExpire() { // 2 FlareLaneNotificationServiceExtensionHelper.shared.serviceExtensionTimeWillExpire() } } ``` ```objective-c @import FlareLane; @implementation NotificationService - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { // 1 // 플레어레인에서 발송한 푸시는 플레어레인의 메소드만 동작하도록 분기 처리합니다. if ([[FlareLaneNotificationServiceExtensionHelper shared] isFlareLaneNotification:request]) { [[FlareLaneNotificationServiceExtensionHelper shared] didReceive:request withContentHandler:contentHandler]; } else { // ... } } - (void)serviceExtensionTimeWillExpire { // 2 [[FlareLaneNotificationServiceExtensionHelper shared] serviceExtensionTimeWillExpire]; } ``` -------------------------------- ### Set User Attributes Source: https://flarelane.com/ko/docs/web-sdk-reference Updates the user profile with specific attributes. ```javascript // SET FlareLane.setUserAttributes({ "name": "김철수", "phoneNumber": "+821012341234", "dob": "1992-03-01", "email": "kevin@flarelane.com", "country": "KR", "language": "ko", "timeZone": "Asia/Seoul" }); ``` -------------------------------- ### 메시지 개인화 변수 사용법 Source: https://flarelane.com/ko/docs/data-integrations/events Liquid 문법을 사용하여 메시지 내용에 이벤트 데이터를 반영하는 방법입니다. ```liquid {{ entry_event.data.데이터명 | default: 기본값 }} ``` -------------------------------- ### Add SDK Dependency Source: https://flarelane.com/ko/docs/sdk-integrations/android-sdk Include the FlareLane SDK dependency in your app-level build.gradle file. ```kotlin dependencies { // 아래 줄 추가 implementation("com.github.flarelane:flarelane-android-sdk:1.10.0") } ``` ```groovy dependencies { // 아래 줄 추가 implementation 'com.github.flarelane:flarelane-android-sdk:1.10.0' } ``` -------------------------------- ### Set SDK Log Level Source: https://flarelane.com/ko/docs/web-sdk-reference Configures the verbosity of SDK logs. ```javascript FlareLane.setLogLevel('verbose'); ``` -------------------------------- ### 태그 데이터 구조 예시 Source: https://flarelane.com/ko/docs/data-integrations/user-attributes-tags 커스텀 태그로 연동 가능한 데이터 구조의 예시입니다. ```json { "gender": "male", "order_count": 2, "liked_products": [1,2,3], "coupon_names": ["쿠폰1","쿠폰2","쿠폰3"], "firstPurchasedAt": "2024-04-19T14:23:56+09:00" "ad_agreement_datetime": "2024-04-19T14:23:56+09:00" } ``` -------------------------------- ### 알림별 URL 처리 비활성화 Source: https://flarelane.com/ko/docs/sdk-integrations/disable-click-url-processing 알림 발송 시 data 필드에 특정 키와 값을 추가하여 개별 알림의 URL 자동 처리를 비활성화합니다. ```json { "flarelane_dismiss_launch_url": "true" } ``` -------------------------------- ### FlareLane.setTags Source: https://flarelane.com/ko/docs/web-sdk-reference Sets tags for the user or device. ```APIDOC ## FlareLane.setTags ### Description Sets tags for the user or device. ### Parameters - **tags** (Record) - Required ``` -------------------------------- ### 발송 API 데이터 파라미터 활용 Source: https://flarelane.com/ko/docs/targets/personalized-messages API 요청 시 data 파라미터를 통해 메시지 내 변수 값을 전달합니다. ```json POST https://api.flarelane.com/v1/projects//notifications { targetType: userId, targetIds: "USER_ID", body: "{{ writerName }}님이 회원님의 글을 좋아합니다." data: { writerName: "민혁" } } ``` -------------------------------- ### S3 인라인 정책 설정 Source: https://flarelane.com/ko/docs/exports/export-events-to-s3 생성한 IAM Role에 S3 버킷 접근 권한을 부여하기 위한 인라인 정책입니다. 을 실제 S3 버킷 이름으로 변경하십시오. ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::", "arn:aws:s3:::/*" ] } ] } ``` -------------------------------- ### Configure AppDelegate for Remote Notifications Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Register the device token with FlareLane in the AppDelegate for both Swift and Objective-C. ```swift import FlareLane class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // 2 FlareLaneAppDelegate.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken) } } ``` ```objective-c @import FlareLane; @implementation AppDelegate - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // 2 [[FlareLaneAppDelegate shared] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } ``` -------------------------------- ### Configure Android compileSdkVersion Source: https://flarelane.com/ko/docs/sdk-integrations/react-native-sdk Update the app/build.gradle file to support Android 13 by setting compileSdkVersion and targetSdkVersion to 33. ```gradle android { compileSdkVersion 33 ... defaultConfig { ... targetSdkVersion 33 } } ``` -------------------------------- ### Set Converted Handler Source: https://flarelane.com/ko/docs/web-sdk-reference Registers a callback to execute when a user clicks a notification and enters the service. ```javascript FlareLane.setConvertedHandler((notification) => { // Do something... console.log(notification); }); ``` -------------------------------- ### Subscribe to Notifications Source: https://flarelane.com/ko/docs/mobile-sdk-reference Enables push notifications. If permissions are missing, it triggers the permission request popup or redirects to system settings. ```Android (Kotlin) /* Android SDK >= 1.4.0 Params - Context context - boolean fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - @Nullable IsSubscribedHandler */ FlareLane.subscribe(this, true, FlareLane.IsSubscribedHandler { // Do Something... }) ``` ```Android (Java) /* Android SDK >= 1.4.0 Params - Context context - boolean fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - @Nullable IsSubscribedHandler */ FlareLane.subscribe(this, true, new FlareLane.IsSubscribedHandler() { @Override public void onSuccess(boolean isSubscribed) { // Do Something... } }); ``` ```iOS (Swift) /* iOS SDK >= 1.4.0 Params - fallbackToSettings: Bool - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - completion: ((Bool) -> Void)? */ FlareLane.subscribe(fallbackToSettings: true) { isSubscribed in // Do Something... } ``` ```iOS (Objective-C) /* iOS SDK >= 1.4.0 Params - (BOOL) fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - (void (^)(_Bool)) completion */ [FlareLane subscribeWithFallbackToSettings:YES completion:^(BOOL isSubscribed) { // Do Something... }]; ``` ```Flutter /* Flutter SDK >= 1.4.0 Params - bool? fallbackToSettings - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - void Function(bool)? callback */ await FlareLane.shared.subscribe(true, (isSubscribed) { // Do Something... }); ``` ```React Native /* React Native SDK >= 1.4.0 Params - fallbackToSettings: boolean - 알림 권한 띄울 수 없을 때 알림 설정으로 이동 - callback?: (isSubscribed: boolean) => void */ FlareLane.subscribe(true, (isSubscribed) => { // Do Something... }); ``` -------------------------------- ### Set Subscription Status Source: https://flarelane.com/ko/docs/web-sdk-reference Manually manages the device subscription status. Setting to true triggers the permission request flow. ```javascript const callback = (isSubscribed) => { // Do something... console.log(isSubscribed); }; // SUBSCRIBE FlareLane.setIsSubscribed(true, callback); // UNSUBSCRIBE FlareLane.setIsSubscribed(false, callback); ``` -------------------------------- ### Track Events Source: https://flarelane.com/ko/docs/web-sdk-reference Triggers an event for the current user or device. ```javascript FlareLane.trackEvent('test_event'); // OR FlareLane.trackEvent('test_event', { "dataKey": "dataValue" }); ``` -------------------------------- ### 메시지별 알림 채널 설정 Source: https://flarelane.com/ko/docs/sdk-integrations/android-notification-channel 메시지 데이터 필드에 채널 ID를 설정하여 메시지마다 다른 알림 채널을 사용하도록 구성합니다. ```json { "data": { "flarelane_notification_channel_id": "YOUR_CHANNEL_ID" } } ``` -------------------------------- ### FlareLane.setLogLevel Source: https://flarelane.com/ko/docs/web-sdk-reference Sets the logging level for the SDK. ```APIDOC ## FlareLane.setLogLevel ### Description Sets the SDK log level. ### Parameters - **logLevel** ('none' | 'error' | 'verbose') - Required ``` -------------------------------- ### FlareLane.subscribe Source: https://flarelane.com/ko/docs/mobile-sdk-reference Subscribes the user to notifications. If permission is not granted, it triggers the permission request or navigates to system settings. ```APIDOC ## FlareLane.subscribe ### Description Subscribes the user to notifications. If permission is not granted, it triggers the permission request or navigates to system settings. ### Parameters - **fallbackToSettings** (boolean) - Required - Whether to navigate to system settings if permission cannot be requested. - **callback/completion** (function) - Optional - Callback function receiving the resulting subscription status. ``` -------------------------------- ### Configure Android compileSdkVersion Source: https://flarelane.com/ko/docs/sdk-integrations/flutter-sdk Set the compileSdkVersion to at least 33 in the android/app/build.gradle file to support Android 13. ```gradle // ... android { compileSdkVersion 33 // ... } // ... ``` -------------------------------- ### Sync Attribution Data in Flutter Source: https://flarelane.com/ko/docs/external-integrations/airbridge Handle attribution events in Flutter to map Airbridge data to FlareLane tags. ```dart FlareLane.shared.initialize("PROJECT_ID", requestPermissionOnLaunch: true); Airbridge.setOnAttributionReceived((result) { Map tags = {}; if (result['attributedChannel'] != null) { tags['attributedChannel'] = result['attributedChannel']!; } if (result['attributedCampaign'] != null) { tags['attributedCampaign'] = result['attributedCampaign']!; } if (result['attributedAdGroup'] != null) { tags['attributedAdGroup'] = result['attributedAdGroup']!; } if (result['attributedAdCreative'] != null) { tags['attributedAdCreative'] = result['attributedAdCreative']!; } if (tags.isNotEmpty) { FlareLane.shared.setTags(tags); } }); ``` -------------------------------- ### FlareLane.setUserAttributes Source: https://flarelane.com/ko/docs/web-sdk-reference Sets user profile attributes. ```APIDOC ## FlareLane.setUserAttributes ### Description Sets user profile attributes. ### Parameters - **userAttributes** (Record) - Required ``` -------------------------------- ### Register Android JavaScript Interface Source: https://flarelane.com/ko/docs/sdk-integrations/webview-bridge Register the FlareLane bridge interface with the WebView using the standard JavaScript interface method. ```kotlin webView.addJavascriptInterface( FlareLaneJavascriptInterface(context, webView), FlareLaneJavascriptInterface.BRIDGE_NAME ) ``` ```java webView.addJavascriptInterface( new FlareLaneJavascriptInterface(context, webView), FlareLaneJavascriptInterface.BRIDGE_NAME ); ``` -------------------------------- ### FlareLane.getIsSubscribed Source: https://flarelane.com/ko/docs/web-sdk-reference Checks the current subscription status of the device. ```APIDOC ## FlareLane.getIsSubscribed ### Description Checks the current device subscription status. ### Parameters - **callback** ((Boolean) => {}) - Required ```