コンテンツにジャンプ

はじめに

ターミナルウィンドウ
bun add @capgo/capacitor-appsflyer
bunx cap sync

インポート

インポート
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);

SDKを手動で開始モードで開始します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.startSDK();

アプリ内イベントを記録します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logEvent({} as AFEvent);

お客様のユーザーIDを設定すると、AppsFlyerのユニークIDと他のデバイスのIDとをクロス参照できます。 このIDは、raw-data レポートとPostback APIのクロス参照用に利用できます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCustomerUserId({} as AFCuid);

アプリ内購入の為の通貨を設定します。3桁のISO 4217 codeを指定してください。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setCurrencyCode({} as AFCurrency);

AndroidのGCM/FCMトークンまたはiOSのAPNs トークンを渡します。別のプラグインが収集した場合。 この機能を使用して、アンインストール測定トークンをAppsFlyerに送信します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.updateServerUninstallToken({} as AFUninstall);

インベストのAttributionのために、一リンクIDを設定します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAppInviteOneLink({} as AFOnelinkID);

AppsFlyerが短いリンク内に隠した属性パラメーターを解決できるように、ブランドされたOneLinkドメインを登録します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setOneLinkCustomDomain({} as AFOnelinkDomain);

App Linksのデープリンクの属性を有効にするには、このメソッドを呼び出してください。 startSDK(). 少なくとも pidis_retargeting=true パラメーター マップに含める必要があります。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.appendParametersToDeepLinkingURL({} as AFAppendToDeepLink);

AppsFlyerのOneLinkが別のUniversal Linkの中に包まれている場合に使用します。 SDKが包まれたURLを解決するようにします。デープリンクが正しく機能するようにします。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setResolveDeepLinkURLs({} as AFUrls);

SDKがプッシュ通知パケットからデープリンク値を抽出する方法を設定します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.addPushNotificationDeepLinkPath({} as AFPath);

AppsFlyerの指定されたパートナーにイベントを伝播させないようにします。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilter({} as AFFilters);

すべてのAppsFlyerパートナーにイベントを伝播させないようにします。setSharingFilterを上書きします。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForAllPartners();

AppsFlyerの指定されたパートナーにイベントを伝播させないようにします。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setSharingFilterForPartners({} as AFFilters);

AppsFlyerに送信する追加のkey-valueデータを設定します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setAdditionalData({} as AFData);

AppsFlyerのユニークデバイスIDを取得します (アプリの新しいインストールごとに作成されます)。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getAppsFlyerUID();

AppsFlyerの分析からユーザーを匿名化する (ユーザーデータを非表示にする)。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.anonymizeUser({} as AFAnonymizeUser);

このAPIが呼び出された後、SDKはサーバーと通信できなくなり、機能を停止します。 ユーザーがオプトイン/オプトアウトを実装する際に便利です。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.stop();

SKAdNetworkのオプトアウト

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableSKAdNetwork({} as AFDisable);

SDKが収集する広告IDのさまざまな種類を非活性化します。この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);

Apple Search AdsのAttributionのオプトアウト

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableCollectASA({} as AFDisable);

カスタムホストを設定

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setHost({} as AFHost);

既存のユーザーが友達や連絡先を新しいユーザーとしてアプリに招待できるようにする

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.generateInviteLink({} as AFLinkGenerator);

API をサーバーで購入アプリの検証。検証が成功すると、関連する値を含む af_purchase イベントが自動的にログに記録されます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseAndroid({} as AFAndroidInAppPurchase);

現在の契約のソース定義を参照してください。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseIos({} as AFIosInAppPurchase);

アプリで使用されている AppsFlyer SDK のバージョンを取得します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.getSdkVersion();
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);

AppsFlyer ダッシュボードで表示されるアプリ ID を使用してください。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logCrossPromoteImpression({} as AFPromotion);

ユーザーEメールを設定し、暗号化します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setUserEmails({} as AFEmails);

ユーザーの位置を手動でログします

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logLocation({} as AFLatLng);

SHA-256で暗号化された文字列として送信されます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPhoneNumber({} as AFPhone);

クリップボードにコピー

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setPartnerData({} as AFPartnerData);

ユーザー招待のインスタントイベントをログに記録するために使用します (af_invite).

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logInvite({} as AFLogInvite);

ネットワークオペレータ名 (キャリア) と SIM オペレータ名をデバイスから収集しないようにするために使用します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setDisableNetworkData({} as AFDisable);

CMP を使用するユーザー向けに、自動的にconsentデータの収集を有効/無効にするために使用します。 フラグ値はアプリのセッション間で保存されます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.enableTCFDataCollection({} as AFEnableTCFDataCollection);

ユーザーconsentデータを手動で設定するために使用します。 TCF v2.2に互換性のあるCMPを使用しない場合は、以下の方法を使用して、consentデータを直接SDKに提供します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentData({} as AFConsentData);

広告収益を特定することで、アプリの所有者はユーザーのLTVとキャンペーンROIを完全に把握できます。 広告収益は、報酬ビデオ、オファー ウォール、インスタンス広告、バナー広告などを表示することで生成されます。 このメソッドを使用して、広告収益をログできます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.logAdRevenue({} as AFAdRevenueData);

このメソッドを使用して、ユーザーの同意データを手動で設定できます。 CMPがTCF v2.2に互換性がある場合、使用していない場合は、次のメソッドを使用して、手動で同意データを直接SDKに提供します。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.setConsentDataV2({} as AFConsentOptions);

このメソッドを使用して、現在のセッションでAppsFlyer SDKがすでに開始されているかどうかを確認できます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStarted();

このメソッドを使用して、AppsFlyer SDKが現在停止されているかどうかを確認できます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.isSDKStopped();

AppSet IDの収集を無効にします。SDKの初期化前に呼び出された場合、App Set IDは収集されません。 初期化後に呼び出された場合、App Set IDは収集されますが、リクエストパayloadには送信されません。 Androidのみ。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.disableAppSetId();

APIは、サーバーでのインアプリ購入V2の検証用です。 検証が成功した場合、関連する値を持つaf_purchaseイベントが自動的にログされます。

import { AppsFlyer } from '@capgo/capacitor-appsflyer';
await AppsFlyer.validateAndLogInAppPurchaseV2({} as AFPurchaseDetailsV2);

このページはプラグインの src/definitions.tspublic APIがアップストリームで変更された場合に再度syncを実行してください。