React Native SDK - 구성 방법 참조

문서

React Native SDK 설정 메서드 레퍼런스

이 레퍼런스는 SingularConfig 클래스에서 사용할 수 있는 설정 메서드에 대해 설명합니다. 이 메서드들은 빌더 패턴을 사용하여 Singular SDK를 초기화하기 위한 구성 객체를 생성합니다. 각 메서드는 SingularConfig 객체 자체를 반환하므로 메서드 연쇄가 가능합니다.

withClipboardAttribution

SingularConfig.withClipboardAttribution Method

딥링킹을 사용할 수 없는 경우 클립보드 기반 어트리뷰션을 활성화하여 추적을 개선합니다.

서명

withClipboardAttribution(): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withClipboardAttribution();

withConversionValueUpdatedHandler

SingularConfig.withConversionValueUpdatedHandler Method

SKAdNetwork 전환 값이 업데이트될 때 호출할 핸들러 함수를 설정합니다(iOS 14 이상만 해당).

시그니처

withConversionValueUpdatedHandler(handler: (value: number) => void): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withConversionValueUpdatedHandler((value) => { 
        console.log("Conversion value updated to:", value); 
        // Perform actions based on the new conversion value 
});

withConversionValuesUpdatedHandler

SingularConfig.withConversionValuesUpdatedHandler Method

SKAdNetwork 4.0 전환 값이 업데이트될 때 호출할 핸들러 함수를 설정합니다(iOS 16.1 이상만 해당).

Signature

withConversionValuesUpdatedHandler(handler: (fineValue: number, coarseValue: number, lockWindow: boolean) => void): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withConversionValuesUpdatedHandler((fineValue, coarseValue, lockWindow) => { 
        console.log("Fine value:", fineValue); 
        console.log("Coarse value:", coarseValue); 
        console.log("Lock window:", lockWindow); 
        // Handle updated conversion values 
});

withCustomSdid

SingularConfig.withCustomSdid Method

엔터프라이즈 기능: ID를 설정하고 수신할 때 콜백 핸들러가 있는 사용자 지정 SDID(Singular 디바이스 ID)를 설정합니다.

서명

withCustomSdid(customSdid: string, didSetSdidCallback: (result: string) => void, sdidReceivedCallback: (result: string) => void): SingularConfig

사용 예

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withCustomSdid(
        "custom-device-id-12345", 
        (result) => { console.log("SDID set result:", result); }, 
        (result) => { console.log("SDID received:", result); });

withCustomUserId

SingularConfig.withCustomUserId Method

현재 사용자 세션에 대한 사용자 지정 사용자 식별자를 설정합니다.

서명

withCustomUserId(customUserId: string): SingularConfig

사용 예

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withCustomUserId("user_123456");

withDeviceAttributionCallbackHandler

SingularConfig.withDeviceAttributionCallbackHandler Method

베타 기능: 디바이스 어트리뷰션 데이터를 사용할 수 있을 때 수신할 핸들러 함수를 설정합니다.

서명

withDeviceAttributionCallbackHandler(deviceAttributionCallbackHandler: (attributes: Map<string, any>) => void): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withDeviceAttributionCallbackHandler((attributes) => {
        // Process attribution data 
        console.log("Attributes:", JSON.stringify(Object.fromEntries(attributes)));
        
        // Use attribution data to customize user experience
        if (attributes.get("source") === "facebook") {
          // Show Facebook-specific welcome message
        }
});

withEspDomains

SingularConfig.withEspDomains Method

이메일 어트리뷰션을 위한 ESP(이메일 서비스 제공업체) 도메인 목록을 설정합니다.

서명

withEspDomains(domains: [string]): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withEspDomains([ "mailchimp.com", "sendgrid.net", "klaviyo.com" ]);

withFacebookAppId

SingularConfig.withFacebookAppId Method

페이스북 캠페인을 통한 어트리뷰션 개선을 위해 페이스북 앱 ID를 설정합니다.

서명

withFacebookAppId(appId: string): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withFacebookAppId("123456789012345");

withGlobalProperty

SingularConfig.withGlobalProperty Method

Singular로 전송되는 모든 이벤트에 포함될 글로벌 속성을 설정합니다.

서명

withGlobalProperty(key: string, value: string, overrideExisting: boolean): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withGlobalProperty("app_version", "1.2.3", true)
     .withGlobalProperty("user_tier", "premium", false);

withLimitDataSharing

SingularConfig.withLimitDataSharing Method

개인정보 보호 규정 준수(예: CCPA)를 위한 데이터 공유 제한을 구성합니다.

서명

withLimitDataSharing(shouldLimitDataSharing: boolean): SingularConfig

사용 예

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withLimitDataSharing(true);

withLimitedIdentifiersEnabled

SingularConfig.withLimitedIdentifiersEnabled Method

개인정보 보호 중심의 어트리뷰션에 대해 제한된 식별자의 사용을 활성화 또는 비활성화합니다.

서명

withLimitedIdentifiersEnabled(limitedIdentifiersEnabled: boolean): SingularConfig

사용 예

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withLimitedIdentifiersEnabled(true);

withLogLevel

SingularConfig.withLogLevel Method

Singular SDK의 로깅 수준을 설정합니다.

서명

withLogLevel(level: number): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withLogLevel(3);

withLoggingEnabled

SingularConfig.withLoggingEnabled Method

디버깅 목적으로 상세 로깅을 활성화합니다.

Signature

withLoggingEnabled(): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withLoggingEnabled();

withManualSkanConversionManagement

SingularConfig.withManualSkanConversionManagement Method

SKAdNetwork 전환을 수동으로 관리할 수 있습니다(iOS만 해당).

서명

withManualSkanConversionManagement(): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withManualSkanConversionManagement();

withOAIDCollection

SingularConfig.withOAIDCollection Method

중국 안드로이드 기기에서 어트리뷰션을 위한 OAID 수집을 활성화합니다.

Signature

withOAIDCollection(): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withOAIDCollection();

withPushNotificationsLinkPaths

SingularConfig.withPushNotificationsLinkPaths Method

푸시 알림 페이로드에서 Singular 링크가 발견될 수 있는 경로를 구성합니다.

서명

withPushNotificationsLinkPaths(pushNotificationsLinkPaths: [[string]]): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withPushNotificationsLinkPaths([ 
        ["data", "singular_link"], 
        ["custom", "tracking_url"] 
        ]);

withSessionTimeoutInSec

SingularConfig.withSessionTimeoutInSec Method

세션 시간 초과 기간을 초 단위로 설정합니다.

서명

withSessionTimeoutInSec(sessionTimeout: number): SingularConfig

사용 예

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withSessionTimeoutInSec(60);

withShortLinkResolveTimeout

SingularConfig.withShortLinkResolveTimeout Method

짧은 링크를 확인하기 위한 시간 제한을 초 단위로 설정합니다.

서명

withShortLinkResolveTimeout(shortLinkResolveTimeout: number): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withShortLinkResolveTimeout(10);

withSingularLink

SingularConfig.withSingularLink Method

사용자가 추적 링크를 통해 앱을 열 때 Singular 딥링크를 처리하는 핸들러를 구성합니다.

서명

withSingularLink(handler: (params: SingularLinkParams) => void): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withSingularLink(singularLinkParams => { 
          const deeplink = singularLinkParams.deeplink; 
          const passthrough = singularLinkParams.passthrough; 
          const isDeferred = singularLinkParams.isDeferred;

          // Add your deep link handling logic here
          if (deeplink && deeplink.includes('product')) {
               // Navigate to product page
               console.log("Navigating to product from deeplink:", deeplink);
          }

          // Use passthrough data if available
          if (passthrough) {
               console.log("Passthrough data:", passthrough);
          }

          // Check if this was a deferred deep link
          if (isDeferred) {
               console.log("This was a deferred deep link");
          }
});

withSkAdNetworkEnabled

SingularConfig.withSkAdNetworkEnabled Method

iOS 14+ 어트리뷰션에 대한 SKAdNetwork 지원을 활성화 또는 비활성화합니다.

시그니처

withSkAdNetworkEnabled(enabled: boolean): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withSkAdNetworkEnabled(true);

withWaitForTrackingAuthorizationWithTimeoutInterval

SingularConfig.withWaitForTrackingAuthorizationWithTimeoutInterval Method

사용자의 트래킹 인증 응답을 기다릴 시간 제한 간격(초)을 설정합니다(iOS 14+에만 해당).

서명

withWaitForTrackingAuthorizationWithTimeoutInterval(interval: number): SingularConfig

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withWaitForTrackingAuthorizationWithTimeoutInterval(30);

Complete Configuration Example

Chaining Multiple Configuration Methods

여러 구성 방법을 함께 연결하는 방법을 보여주는 예제입니다.

사용 예시

typescript
const config = new SingularConfig("SDK KEY", "SDK SECRET")
     .withWaitForTrackingAuthorizationWithTimeoutInterval(30)
     .withCustomUserId("user_123456")
     .withGlobalProperty("key_1", "value1", true)
     .withLimitDataSharing(false)
     .withFacebookAppId("123456789012345");
     .withSingularLink((params) = {
        // Handle deep link parameters 
        if (params.deeplink) { 
             console.log("Deep link received:", params.deeplink); 
        } 
     })

// Initialize Singular with the configuration
Singular.init(config);