プラグインは、AppsFlyerObject prefabを使用、または手動で初期化できます。

AppsFlyerObject.prefab の使用

  1. Assets > AppsFlyer に移動し、AppFlyerObject.prefab をシーンにドラッグします。


  2. 次の項目を更新します:
設定項目詳細
Dev KeyAppsFlyerのDev Key - AppsFlyer管理画面から取得できます
アプリIDiTunesアプリID (アプリが iOS用でない場合は、項目を空のままにします)
Get Conversion DataディープリンクにAppsFlyerを使用している場合は、これをtrueに設定します。
Is Debugデバッグログを表示するには、true に設定します。(開発用)
  1. 他の利用可能なAPIと一緒に、Assets > AppsFlyerObjectScript.cs でコードをアップデートします。

マニュアル連携

ゲームオブジェクトを作成し、以下のinitコードを追加してください:

using AppsFlyerSDK;

public class AppsFlyerObjectScript : MonoBehaviour
{
  void Start()
  {
    AppsFlyer.initSDK("devkey", "appID");
    AppsFlyer.startSDK();
  }
}

注意:

  • ゲームオブジェクトでdestroyを呼び出さないようにしてください。
  • Use DontDestroyOnLoad を使用して、新しいシーンをロードするときにオブジェクトを保持します。

Set customer user ID

Set your own unique customer user ID (CUID) and cross-reference it with the unique AppsFlyer ID.

  • Appear in AppsFlyer raw data CSV reports.
  • Can be used in postback APIs to cross-reference with internal IDs.
    To set the CUID, use:
AppsFlyer.setCustomerUserId("someId");

Good practice! Set the CUID early in the app flow—it is only associated with events reported after its setup.

  • Recorded events will be associated with the CUID.
  • Related data will appear in the raw data reports for installs and events..

Associate the CUID with the install event

If it’s important for you to associate the install event with the CUID, call setCustomerUserId before calling startSDK.

ATTrackingManagerで IDFAを収集する

  1. Add the AppTrackingTransparency フレームワークをXcodeプロジェクトに追加します。

  2. In the Info.plist:

    1. リストにエントリを追加:以下リストの横にある + をクリックします
      Information Property List.
    2. スクロールダウンして次を選択します: Privacy - Tracking Usage Description.
    3. IDFAを収集する許可を求める際にユーザーに提示したい文言を値として追加します。
  3. API waitForATTUserAuthorizationWithTimeoutInterval を次のメソッドの前にコールします: startSDK()

    #if UNITY_IOS && !UNITY_EDITOR
    AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(60);
    #endif
    
  4. プロンプト(ATTダイアログ)を表示する追跡承認をリクエストします。

    次のパッケージ、または追跡承認をリクエストできるその他のパッケージを使用できます。

    
    using Unity.Advertisement.IosSupport;
    
    /*  ... */
    
    if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() 
         == ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
        {
            ATTrackingStatusBinding.RequestAuthorizationTracking();
        }
     /*  ... */
    

Customizing the ATT consent dialog

The ATT consent dialog can be customized by modifying your Xcode project's info.plist:

詳しい説明は、Appleのドキュメントを参照してください。


SKANポストバックをAppsFlyerに送信する

AppsFlyerエンドポイントを登録するには、info.plist に NSAdvertisingAttributionReportEndpoint を追加し、値を https://appsflyer-skadnetwork.com/ と設定します。
info.plist を更新する方法の詳細については、 こちらを参照してください。


macOSの初期化

  1. 次を使用してください:prefab AppsFlyerObject
  2. MacOS app idを追加します。
  3. プラットフォーム PC, Mac & Linux Standelone 向けにビルドし、ターゲットプラットフォームとして MacOS を選択します。

リクエストリスナー(オプション)

  1. ゲームオブジェクトへ AppsFlyer初期化コードと一緒に 'AppsFlyer.cs' スクリプトを添付します。(AppsFlyerObject, ect)
  2. startSDK() の前に 次のコードを追加します。

セッションレスポンスの例:

    void Start()
    {
        AppsFlyer.OnRequestResponse += AppsFlyerOnRequestResponse;
        
        AppsFlyer.initSDK(devKey, appID, this);
        AppsFlyer.startSDK();
    }

    void AppsFlyerOnRequestResponse(object sender, EventArgs e)
    {
        var args = e as AppsFlyerRequestEventArgs;
        AppsFlyer.AFLog("AppsFlyerOnRequestResponse", " status code " + args.statusCode);
    }

アプリ内イベントレスポンスの例:

    void Start()
    {
        AppsFlyer.OnInAppResponse += (sender, args) =>
        {
            var af_args = args as AppsFlyerRequestEventArgs;
            AppsFlyer.AFLog("AppsFlyerOnRequestResponse", " status code " + af_args.statusCode);
        };
        
        AppsFlyer.initSDK(devKey, appID, this);
        AppsFlyer.startSDK();
    }


statusCodeerrorDescription
200null
10"Event timeout. Check 'minTimeBetweenSessions' param"
11"Skipping event because 'isStopTracking' enabled"
40ネットワークエラー:Android経由のエラーの説明
41"No dev key"
50"Status code failure" + サーバーからの実際のエラーコード