React Native SDK 設定メソッドリファレンス
このリファレンスでは、SingularConfig クラスで使用できる設定メソッドについて説明します。これらのメソッドは Builder パターンを使用して、Singular SDK を初期化するための設定オブジェクトを作成します。各メソッドはSingularConfigオブジェクト自身を返すので、メソッドの連鎖が可能です。
withClipboardAttribution
SingularConfig.withClipboardAttribution Method
ディープリンクが利用できない場合に、クリップボードベースのアトリビューションを有効にしてトラッキングを改善します。
シグネチャ
withClipboardAttribution(): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withClipboardAttribution();
withConversionValueUpdatedHandler
SingularConfig.withConversionValueUpdatedHandler Method
SKAdNetwork変換値が更新されたときに呼び出されるハンドラ関数を設定します(iOS 14+のみ)。
シグネチャ
withConversionValueUpdatedHandler(handler: (value: number) => void): SingularConfig
使用例
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+のみ)。
シグネチャ
withConversionValuesUpdatedHandler(handler: (fineValue: number, coarseValue: number, lockWindow: boolean) => void): SingularConfig
使用例
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
エンタープライズ向け機能:カスタムSDID(Singular Device ID)を設定し、IDの設定時と受信時のコールバックハンドラを設定します。
シグネチャ
withCustomSdid(customSdid: string, didSetSdidCallback: (result: string) => void, sdidReceivedCallback: (result: string) => void): SingularConfig
使用例
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
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withCustomUserId("user_123456");
withDeviceAttributionCallbackHandler
SingularConfig.withDeviceAttributionCallbackHandler Method
BETA機能:デバイス属性データが利用可能になったときに、それを受信するハンドラ関数を設定します。
シグネチャ
withDeviceAttributionCallbackHandler(deviceAttributionCallbackHandler: (attributes: Map<string, any>) => void): SingularConfig
使用例
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
Eメール帰属のためのESP(Eメールサービスプロバイダ)ドメインのリストを設定します。
署名
withEspDomains(domains: [string]): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withEspDomains([ "mailchimp.com", "sendgrid.net", "klaviyo.com" ]);
withFacebookAppId
SingularConfig.withFacebookAppId Method
Facebookキャンペーンでアトリビューションを向上させるために、FacebookアプリIDを設定します。
署名
withFacebookAppId(appId: string): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withFacebookAppId("123456789012345");
withGlobalProperty
SingularConfig.withGlobalProperty Method
Singularに送信されるすべてのイベントに含まれるグローバルプロパティを設定します。
署名
withGlobalProperty(key: string, value: string, overrideExisting: boolean): SingularConfig
使用例
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
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withLimitDataSharing(true);
withLimitedIdentifiersEnabled
SingularConfig.withLimitedIdentifiersEnabled Method
プライバシーを重視した帰属のための限定識別子の使用を有効または無効にする。
署名
withLimitedIdentifiersEnabled(limitedIdentifiersEnabled: boolean): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withLimitedIdentifiersEnabled(true);
withLogLevel
SingularConfig.withLogLevel Method
Singular SDKのログレベルを設定します。
署名
withLogLevel(level: number): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withLogLevel(3);
withLoggingEnabled
SingularConfig.withLoggingEnabled Method
デバッグ用の詳細なロギングを有効にします。
署名
withLoggingEnabled(): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withLoggingEnabled();
withManualSkanConversionManagement
SingularConfig.withManualSkanConversionManagement Method
SKAdNetworkの変換を手動で管理できるようにする(iOSのみ)。
署名
withManualSkanConversionManagement(): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withManualSkanConversionManagement();
withOAIDCollection
SingularConfig.withOAIDCollection Method
中国のAndroidデバイスで、アトリビューション用のOAIDを収集できるようにする。
署名
withOAIDCollection(): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withOAIDCollection();
withPushNotificationsLinkPaths
SingularConfig.withPushNotificationsLinkPaths Method
プッシュ通知のペイロードでSingularリンクが見つかるパスを設定します。
署名
withPushNotificationsLinkPaths(pushNotificationsLinkPaths: [[string]]): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withPushNotificationsLinkPaths([
["data", "singular_link"],
["custom", "tracking_url"]
]);
withSessionTimeoutInSec
SingularConfig.withSessionTimeoutInSec Method
セッションのタイムアウト時間を秒単位で設定します。
署名
withSessionTimeoutInSec(sessionTimeout: number): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withSessionTimeoutInSec(60);
withShortLinkResolveTimeout
SingularConfig.withShortLinkResolveTimeout Method
短いリンクを解決する際のタイムアウト時間を秒単位で設定する。
署名
withShortLinkResolveTimeout(shortLinkResolveTimeout: number): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withShortLinkResolveTimeout(10);
withSingularLink
SingularConfig.withSingularLink Method
ユーザーがトラッキングリンクからアプリを開いたときにSingularディープリンクを処理するハンドラを設定します。
シグネチャ
withSingularLink(handler: (params: SingularLinkParams) => void): SingularConfig
使用例
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
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withSkAdNetworkEnabled(true);
withWaitForTrackingAuthorizationWithTimeoutInterval
SingularConfig.withWaitForTrackingAuthorizationWithTimeoutInterval Method
ユーザーのトラッキング承認応答を待つタイムアウト間隔(秒)を設定します(iOS 14+のみ)。
署名
withWaitForTrackingAuthorizationWithTimeoutInterval(interval: number): SingularConfig
使用例
const config = new SingularConfig("SDK KEY", "SDK SECRET")
.withWaitForTrackingAuthorizationWithTimeoutInterval(30);
Complete Configuration Example
Chaining Multiple Configuration Methods
複数のコンフィギュレーション・メソッドを連結する方法を示す例。
使用例
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);