Web SDK Reference
.initialize
Section titled “.initialize”SDK를 초기화합니다.
Params
- options: InitializeOptions
- projectId
- (optional) serviceWorkerPath
FlareLane.initialize({ projectId: "<PROJECT_ID>", serviceWorkerPath: "/sw.js" // optional});.setLogLevel
Section titled “.setLogLevel”SDK의 로그레벨을 설정합니다.
Params
- logLevel: 'none' | 'error' | 'verbose'
- none: 없음
- error: 에러만 표시
- verbose: 전부 표시 (default)
FlareLane.setLogLevel('verbose');알림 구독 처리
Section titled “알림 구독 처리”.getIsSubscribed
Section titled “.getIsSubscribed”현재 기기의 구독 여부를 확인합니다.
Params
- callback: (Boolean) => {}
FlareLane.getIsSubscribed((isSubscribed) => { // Do something... console.log(isSubscribed);});.setIsSubscribed
Section titled “.setIsSubscribed”현재 기기의 구독 여부를 설정합니다.
서비스 내 설정UI 등을 통해 직접 구독 여부를 관리하려는 경우 사용합니다.
true 지정 시 구독을 위한 권한 획득 과정이 한꺼번에 진행됩니다.
Params
- isSubscribed: Boolean
- callback: (Boolean) => {}
const callback = (isSubscribed) => { // Do something... console.log(isSubscribed);};
// SUBSCRIBEFlareLane.setIsSubscribed(true, callback);// UNSUBSCRIBEFlareLane.setIsSubscribed(false, callback);고객 데이터 연동
Section titled “고객 데이터 연동”.setUserId
Section titled “.setUserId”현재 기기에 유저 ID를 설정합니다. 일반적으로, 회원가입/로그인 성공 시 유저 ID를 변경하도록 관리합니다.
Params
- userId: string | null
// SETFlareLane.setUserId("USER_ID");// REMOVEFlareLane.setUserId(null);.trackEvent
Section titled “.trackEvent”이벤트를 트리거합니다. 기기의 유저ID가 존재하는 경우 유저 대상으로, 그 외에는 단일 기기 대상으로 반영됩니다.
Params
- type: string
- (optional) data: Record<string, string | number>
FlareLane.trackEvent('test_event');// ORFlareLane.trackEvent('test_event', { "dataKey": "dataValue" });.setTags
Section titled “.setTags”태그를 반영합니다. 기기의 유저ID가 존재하는 경우 유저 대상으로, 그 외에는 단일 기기 대상으로 반영됩니다.
Params
- tags: Record<string, string | number>
// SETFlareLane.setTags({ gender: "men", age: 24 });.setUserAttributes
Section titled “.setUserAttributes”유저프로필을 반영합니다.
Params
- userAttributes: Record<string, string>
// SETFlareLane.setUserAttributes({ "name": "김철수", "phoneNumber": "+821012341234", "dob": "1992-03-01", "email": "kevin@flarelane.com", "country": "KR", "language": "ko", "timeZone": "Asia/Seoul"});.getDeviceId
Section titled “.getDeviceId”현재 기기의 플레어레인 기기 ID를 가져옵니다
Params
- callback: (string | null) => {}
FlareLane.getDeviceId((deviceId) => { // Do something... console.log(deviceId); });알림 핸들러
Section titled “알림 핸들러”.setConvertedHandler
Section titled “.setConvertedHandler”알림 클릭 후 서비스 진입 시 실행할 콜백 핸들러를 등록합니다.
Params
- callback: (Notification) => {}
FlareLane.setConvertedHandler((notification) => { // Do something... console.log(notification); });.displayInApp
Section titled “.displayInApp”현재 기기가 보여줄 수 있는 특정 그룹의 가장 우선순위 높은 인앱메시지를 노출합니다.
FlareLane.displayInApp("home");.setInAppMessageActionHandler
Section titled “.setInAppMessageActionHandler”인앱메시지 커스텀 액션을 수행하는 경우 이를 처리할 핸들러를 직접 정의합니다.
FlareLane.setInAppMessageActionHandler((iam, actionId) => { // Do Something...});