Getting Started
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップ用質問をコピーしてください。
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.
Install
インストールbun add @capgo/capacitor-appsflyerbunx cap syncImport
インポート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
__CAPGO_KEEP_2__を使用して、__CAPGO_KEEP_0__を初期化して開始します。__CAPGO_KEEP_1__は、可能な限り早くアプリが起動したときに呼び出される必要があります。Use this method to initialize and start AppsFlyer SDK. This API should be called as soon as the app launches.
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.initSDK({} as AFInit);startSDK
startSDKUse this method to start AppsFlyer SDK, only on manual start mode.
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データレポートとPostback APIで利用できます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCustomerUserId({} as AFCuid);setCurrencyCode
setCurrencyCodeSets the currency used for in-app purchases. Provide a three-character ISO 4217 code.
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrencyCode({} as AFCurrency);updateServerUninstallToken
「updateServerUninstallToken」セクションAndroid では GCM/FCM トークン、iOS では APNs トークンを使用して、他のプラグインが収集したトークンをパスします。 AppsFlyer にアンインストール測定トークンを転送するには、このメソッドを使用します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.updateServerUninstallToken({} as AFUninstall);setAppInviteOneLink
「setAppInviteOneLink」セクションインビテーション Attribution のために使用される OneLink ID を設定します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAppInviteOneLink({} as AFOnelinkID);setOneLinkCustomDomain
「setOneLinkCustomDomain」セクションOneLink ドメインを登録して、AppsFlyer が短リンクに隠された Attribution パラメータを解決できるようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setOneLinkCustomDomain({} as AFOnelinkDomain);appendParametersToDeepLinkingURL
「appendParametersToDeepLinkingURL」セクションOneLink がない App Links のデープリンクの Attribution を有効にするには、このメソッドを呼び出してください。
少なくとも startSDK()コピー pid とパラメータマップに。 is_retargeting=true コピー
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.appendParametersToDeepLinkingURL({} as AFAppendToDeepLink);setResolveDeepLinkURLs
AppsFlyer OneLinkが他のUniversal Linkの中に包まれている場合に使用します。
__CAPGO_KEEP_0__が包まれたURLを解決するので、深いリンクが正しく機能します。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
__CAPGO_KEEP_0__がプッシュ通知パケットからデープリンク値を抽出する方法を設定します。Configures how the SDK extracts deep link values from push notification payloads.
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.addPushNotificationDeepLinkPath({} as AFPath);setSharingFilter
AppsFlyerパートナーにイベントを伝播させないようにします。コピー
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilter({} as AFFilters);setSharingFilterForAllPartners
setSharingFilterForAllPartnersすべてのパートナーへのイベントの伝播を停止します。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
setAdditionalDataAppsFlyerに追加のkey-valueデータを送信します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAdditionalData({} as AFData);getAppsFlyerUID
setAdditionalDataAppsFlyerのユニークデバイスIDを取得します (アプリの新しいインストールごとに作成されます)。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getAppsFlyerUID();anonymizeUser
「匿名化ユーザー」セクションアプリフライヤー アナリティクスからエンドユーザーがオプトアウトする (ユーザーデータの匿名化)
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.anonymizeUser({} as AFAnonymizeUser);stop
「停止」セクションAPI が呼び出された後、SDK はサーバーと通信できなくなり、機能を停止します。 ユーザーがオプトイン/オプトアウトを実装する際に便利
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.stop();disableSKAdNetwork
「SKAdNetwork の無効化」セクションSKAdNetwork からオプトアウト
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableSKAdNetwork({} as AFDisable);disableAdvertisingIdentifier
「広告識別子無効化」セクションSDK が広告識別子 (IDFA、GAID、OAID、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
セクションのタイトル “generateInviteLink”既存のユーザーが友達や連絡先を新しいユーザーとしてアプリに招待できるようにします。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.generateInviteLink({} as AFLinkGenerator);validateAndLogInAppPurchaseAndroid
セクションのタイトル “validateAndLogInAppPurchaseAndroid”APIはアプリ内購入のサーバー検証用です。アプリ内購入の検証が成功すると、関連する値を含むaf_purchaseイベントが自動的にログされます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseAndroid({} as AFAndroidInAppPurchase);validateAndLogInAppPurchaseIos
validateAndLogInAppPurchaseIosのセクション現在の契約のソース定義を参照してください。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseIos({} as AFIosInAppPurchase);getSdkVersion
getSdkVersionのセクションアプリに使用されているAppsFlyer SDKのバージョンを取得します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getSdkVersion();enableFacebookDeferredApplinks
enableFacebookDeferredApplinksのセクションFacebook Deferred AppLinksの収集を有効にします。Facebook SDKとFacebookアプリがターゲット/クライアントデバイスにインストールされている必要があります。 このAPIは、AppsFlyer SDKを初期化する前に呼び出す必要があります。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableFacebookDeferredApplinks({} as AFFbDAL);sendPushNotificationData
sendPushNotificationDataのセクションプッシュ通知キャンペーンのデータを取得します。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.sendPushNotificationData({} as AFPushPayload);setCurrentDeviceLanguage
setCurrentDeviceLanguageデバイスの言語を設定します。データはRaw Data Reportsで表示されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrentDeviceLanguage({} as AFLanguage);logCrossPromoteImpression
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
電話番号を設定__CAPGO_KEEP_0__
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPhoneNumber({} as AFPhone);setPartnerData
パートナーデータを設定__CAPGO_KEEP_0__
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPartnerData({} as AFPartnerData);logInvite
ユーザー招待イベントをログ__CAPGO_KEEP_0__
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logInvite({} as AFLogInvite);setDisableNetworkData
ネットワークデータの収集をオフ__CAPGO_KEEP_0__
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setDisableNetworkData({} as AFDisable);enableTCFDataCollection
「enableTCFDataCollection」セクションCMPを使用するユーザー向けに、自動的な同意データの収集を有効/無効にするために使用します。 アプリセッション間でフラグ値が保存されます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableTCFDataCollection({} as AFEnableTCFDataCollection);setConsentData
「setConsentData」セクションCMPと互換性のないアプリでは、直接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と互換性のないアプリでは、直接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
「disableAppSetId」セクションAppSet ID の収集を無効にします。SDK の初期化前に呼び出された場合、App Set ID は収集されません。初期化後に呼び出された場合、App Set ID は収集されますが、リクエスト パayload に送信されません。Android 限定。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAppSetId();validateAndLogInAppPurchaseV2
「validateAndLogInAppPurchaseV2」セクションAPI のサーバー検証用のインアプリ購入 V2 です。 検証が成功した場合、関連する値を含む af_purchase イベントが自動的にログされます。
import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseV2({} as AFPurchaseDetailsV2);真実の源
「真実の源」というセクションこのページはプラグインの src/definitions.ts. 公開 API がアップストリームで変更された場合に、再度 Sync を実行してください。
Getting Started から続けてください
「Getting Started から続けてください」というセクションCapacitor を使用している場合 Getting Started ダッシュボードと API の作業を計画するには、Capacitor を使用して Capacitor の @capgo/capacitor-appsflyer を使用 Capacitor の @capgo/capacitor-appsflyer のネイティブ機能 API の概要 実装詳細については API の概要を参照してください。 概要 実装詳細については Introduction を参照してください。 API のキー 実装詳細については API Keys を参照してください。 デバイス 実装詳細については Devices を参照してください。