はじめに
セットアップのプロンプトをコピーして、インストールの手順とこのプラグインのフルマークダウンガイドを取得します。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-appsflyer`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/appsflyer/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションbun add @capgo/capacitor-appsflyerbunx cap syncインポート
「Import」を選択import { AppsFlyer } from '@capgo/capacitor-appsflyer';import type { AFAdRevenueData, AFAndroidInAppPurchase, AFAnonymizeUser, AFAppendToDeepLink, AFConsentData, AFConsentOptions, AFCuid, AFCurrency, AFData, AFDisable, AFEmails, AFEnableTCFDataCollection, AFEvent, AFFbDAL, AFFilters, AFHost, AFInit, AFIosInAppPurchase, AFLanguage, AFLatLng, AFLinkGenerator, AFLogInvite, AFOnelinkDomain, AFOnelinkID, AFPartnerData, AFPath, AFPhone, AFPromotion, AFPurchaseDetailsV2, AFPushPayload, AFUninstall, AFUrls,} from '@capgo/capacitor-appsflyer';APIの概要
「APIの概要」を選択initSDK
「initSDK」を選択SDKを初期化してアプリを起動します。このAPIは、アプリが起動したときに呼び出してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.initSDK({} as AFInit);startSDK
「startSDK」を選択SDKをアプリが起動したときに呼び出してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.startSDK();logEvent
「logEvent」を選択アプリ内イベントをログします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logEvent({} as AFEvent);setCustomerUserId
セクション「setCustomerUserId」お客様のユニークIDをAppsFlyerのユニークIDと他のデバイスのIDと照合することができます。 このIDは、raw-data レポートとPostback APIのクロス参照に利用できます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCustomerUserId({} as AFCuid);setCurrencyCode
セクション「setCurrencyCode」アプリ内購入の為の通貨を設定します。3桁のISO 4217 codeを指定してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrencyCode({} as AFCurrency);updateServerUninstallToken
セクション「updateServerUninstallToken」AndroidのGCM/FCMトークンまたはiOSのAPNs トークンを渡します。 AppsFlyerに送信するため、アンインストール測定トークンをAppsFlyerに送信します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.updateServerUninstallToken({} as AFUninstall);setAppInviteOneLink
セクション「setAppInviteOneLink」OneLink IDを設定します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAppInviteOneLink({} as AFOnelinkID);setOneLinkCustomDomain
「setOneLinkCustomDomain」を設定ブランド化されたOneLinkドメインを登録して、アプリフライヤーが短いリンクに隠されたAttributionパラメータを解決できるようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setOneLinkCustomDomain({} as AFOnelinkDomain);appendParametersToDeepLinkingURL
「appendParametersToDeepLinkingURL」を設定App LinksのデープリンクにAttributionを有効にするには、このメソッドを呼び出す前に呼び出してください。
パラメータマップには少なくとも「scheme」、「host」、「path」、「query」、「fragment」を含める必要があります。 startSDK()クリップボードにコピー pid 「setResolveDeepLinkURLs」を設定 is_retargeting=true AppsFlyer OneLinkがUniversal Linkの中にwrapされている場合に使用してください。
__CAPGO_KEEP_0__がwrapされたURLを解決できるようにすることで、デープリンクが正しく機能するようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.appendParametersToDeepLinkingURL({} as AFAppendToDeepLink);setResolveDeepLinkURLs
「appendParametersToDeepLinkingURL」を設定Use this when an AppsFlyer OneLink is wrapped inside another Universal Link. It lets the SDK resolve the wrapped URL so deep linking still works correctly.
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setResolveDeepLinkURLs({} as AFUrls);addPushNotificationDeepLinkPath
「addPushNotificationDeepLinkPath」セクションSDKがプッシュ通知のペイロードからデープリンク値を抽出する方法を設定します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.addPushNotificationDeepLinkPath({} as AFPath);setSharingFilter
「setSharingFilter」セクション指定されたAppsFlyerパートナーにイベントを伝播させないようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilter({} as AFFilters);setSharingFilterForAllPartners
「setSharingFilterForAllPartners」セクションすべてのAppsFlyerパートナーにイベントを伝播させないようにします。setSharingFilterを上書きします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForAllPartners();setSharingFilterForPartners
「setSharingFilterForPartners」セクション指定されたAppsFlyerパートナーにイベントを伝播させないようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForPartners({} as AFFilters);setAdditionalData
「setAdditionalData」セクションAppsFlyerに送信する追加のkey-valueデータを設定します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAdditionalData({} as AFData);getAppsFlyerUID
「getAppsFlyerUID」セクションAppsFlyerのユニークデバイスIDを取得します (アプリの新しいインストールごとに作成されます)。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getAppsFlyerUID();anonymizeUser
「anonymizeUser」セクションAppsFlyerの分析からエンドユーザーがオプトアウトする (ユーザーデータを匿名化する)。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.anonymizeUser({} as AFAnonymizeUser);stop
「stop」セクションAPIが呼び出された後、SDKはサーバーと通信しなくなり、機能を停止します。 ユーザーオプトイン/オプトアウトの実装に役立ちます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.stop();disableSKAdNetwork
「disableSKAdNetwork」セクションSKAdNetworkから除外する
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableSKAdNetwork({} as AFDisable);disableAdvertisingIdentifier
「disableAdvertisingIdentifier」セクションSDKが収集する広告IDの種類を、Apple Identity for Advertisers (IDFA)、Google Advertising ID (GAID)、OAID、Amazon Advertising ID (AAID)を含むものに設定します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAdvertisingIdentifier({} as AFDisable);disableCollectASA
「disableCollectASA」セクションApple Search AdsのAttributionをオフにする
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableCollectASA({} as AFDisable);setHost
「setHost」セクションカスタムホストを設定する
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setHost({} as AFHost);generateInviteLink
「招待リンクを生成する」セクション既存のユーザーが友達や連絡先を新しいユーザーとしてアプリに招待できるようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.generateInviteLink({} as AFLinkGenerator);validateAndLogInAppPurchaseAndroid
「Androidアプリ購入の検証とログイン」セクションAPI を使用してサーバーでのアプリ内購入の検証を行います。検証が成功した場合、関連する値を含む af_purchase イベントが自動的にログに記録されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseAndroid({} as AFAndroidInAppPurchase);validateAndLogInAppPurchaseIos
「iOSアプリ購入の検証とログイン」セクション現在の契約のソース定義を参照してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseIos({} as AFIosInAppPurchase);getSdkVersion
「SDKバージョンを取得する」セクションAppsFlyer の SDK バージョンを取得します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getSdkVersion();enableFacebookDeferredApplinks
Facebook Deferred AppLinksの有効化Facebook Deferred AppLinksの収集を有効にします。Facebook SDK と Facebook アプリがターゲット/クライアント デバイスにインストールされている必要があります。 この API を AppsFlyer SDK を初期化する前に呼び出す必要があります。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableFacebookDeferredApplinks({} as AFFbDAL);sendPushNotificationData
送信されたプッシュ通知データの送信プッシュ通知キャンペーンのデータを取得します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.sendPushNotificationData({} as AFPushPayload);setCurrentDeviceLanguage
デバイスの言語を設定デバイスの言語を設定します。データはRaw Data Reportsで表示されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrentDeviceLanguage({} as AFLanguage);logCrossPromoteImpression
クロスプロモーションキャンペーンのインプレッションを記録クロスプロモーションキャンペーンのインプレッションを記録します。AppsFlyer ダッシュボードで表示されるプロモーション アプリ ID を使用してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logCrossPromoteImpression({} as AFPromotion);setUserEmails
「setUserEmails」セクションユーザーのメールアドレスを設定し、暗号化します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setUserEmails({} as AFEmails);logLocation
「logLocation」セクションユーザーの位置を手動でログします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logLocation({} as AFLatLng);setPhoneNumber
「setPhoneNumber」セクションSHA-256で暗号化された文字列として送信されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPhoneNumber({} as AFPhone);setPartnerData
「setPartnerData」セクションパートナーの統合用にカスタムデータを送信することを許可します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPartnerData({} as AFPartnerData);logInvite
「logInvite」セクションユーザー招待のインアプリイベントをログするために使用します (af_invite).
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logInvite({} as AFLogInvite);setDisableNetworkData
「setDisableNetworkData」セクションネットワークオペレータ名 (キャリア) と SIM オペレータ名をデバイスから収集するのをオプトアウトするために使用します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setDisableNetworkData({} as AFDisable);enableTCFDataCollection
「enableTCFDataCollection」セクションCMP を使用するユーザー向けに、自動的にconsentデータの収集を有効/無効にするために使用します。 フラグ値はアプリのセッション間で保持されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableTCFDataCollection({} as AFEnableTCFDataCollection);setConsentData
「setConsentData」セクションユーザーconsentデータを手動で設定するために使用します。 TCF v2.2と互換性のあるCMPを使用しない場合は、以下の方法を使用して、consentデータを直接SDKに提供します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentData({} as AFConsentData);logAdRevenue
「logAdRevenue」セクション広告収益を特定することで、アプリの所有者はユーザーのLTVとキャンペーンのROIを完全に把握できます。 広告収益は、報酬ビデオ、オファー ウォール、インスタンス広告、バナーなど、アプリ内で表示される広告によって生成されます。 このメソッドを使用して、広告収益をログできます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logAdRevenue({} as AFAdRevenueData);setConsentDataV2
「setConsentDataV2」セクションこのメソッドを使用して、ユーザーの同意データを手動で設定できます。 CMPがTCF v2.2に互換性があるアプリが使用していない場合、直接SDKに同意データを提供するために使用する必要があるメソッドです。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentDataV2({} as AFConsentOptions);isSDKStarted
「isSDKStarted」セクションこのメソッドを使用して、現在のセッションでAppsFlyer SDKがすでに開始されているかどうかを確認できます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStarted();isSDKStopped
「isSDKStopped」セクションこのメソッドを使用して、AppsFlyer SDKが現在停止されているかどうかを確認できます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStopped();disableAppSetId
AppSet ID の収集を無効にするAppSet ID の収集を無効にします。SDK の初期化前に呼び出された場合、App Set ID は収集されません。 初期化後に呼び出された場合、App Set ID は収集されますが、リクエスト ペイロードに送信されません。 Android 限定。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAppSetId();validateAndLogInAppPurchaseV2
App 内購入の検証とログイン V2API は、App 内購入の検証 V2 のサーバー検証用です。 検証が成功した場合、関連する値を含む af_purchase イベントが自動的にログされます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseV2({} as AFPurchaseDetailsV2);真実の源
真実の源このページはプラグインの src/definitions.tspublic API のアップストリームの変更が発生した場合に、再度 Sync を実行してください。