ユニファイド ディープリンク(UDL)

❗️

このページは 新しいバージョンへ移行しました

概要:Unified Deep Linking(UDL)により、アプリ起動時に新規および既存ユーザーを特定のアプリ内アクティビティ(例えば、アプリ内の特定のページなど)に誘導することができます。

📘

UDLのプライバシー保護

For new users, the UDL method only returns parameters relevant to deferred deep linking: deep_link_value and deep_link_sub1-10. If you try to get any other parameters (media_source, campaign, af_sub1-5, etc.), they return null.

フロー

1920

UDLはモバイルユーザーをアプリ内の特定のアクティビティまたはコンテンツに誘導します。

計測フローは次のとおりです。

  1. ユーザーがOneLinkのリンクをクリックします。
    • ユーザーがアプリをインストールしている場合は、AndroidアプリリンクまたはURIスキームでアプリを開きます。
    • ユーザーがアプリをインストールしていない場合は、アプリストアにリダイレクトされ、ダウンロード後、アプリを開きます。
  2. アプリ起動がAppsFlyer SDKをトリガーします。
  3. AppsFlyer SDKはUDL APIを実行します。
  4. UDL APIはOneLinkデータをAppsFlyerサーバーから取得します。
  5. The UDL API calls back the onDeepLinking() メソッド DeepLinkingListener class.
  6. The onDeepLinking() method gets a DeepLinkResult object.
  7. The DeepLinkResult object includes:
    • Status (Found/Not found/Error)
    • A DeepLink object that carries the deep_link_value and deep_link_sub1-10 OneLinkの主な目的である特定のアプリ内アクティビティにユーザーをルーティングするために開発者が使用するパラメーター。

前提条件

  • UDL には、AppsFlyer Android SDK V6.1以降が必要です。

計画

OneLinkを設定する際は、マーケティング担当者はこのパラメーターをリンクを作成するために使用し、ディベロッパーは、受け取った値をもとにアプリの動作をカスタマイズします。アプリ内でのルーティングやリンク先でのデータのパーソナライズなど、アプリ内でパラメータが正しく処理されるように実装するのはディベロッパーの責任です。

OneLinkの計画方法:

  1. ユーザーがURLをクリックしたときに、どのような動作が発生し、どのような体験をするのかをマーケティング担当者からヒアリングしてください。
  2. Based on the desired behavior, plan the deep_link_value and other parameters that are needed to give the user the desired personal experience.
    • The deep_link_value is set by the marketer in the URL and used by the developer to redirect the user to a specific place inside the app. For example, if you have a fruit store and want to direct users to apples, the value of deep_link_value can be apples.
    • The deep_link_sub1-10 parameters can also be added to the URL to help personalize the user experience. For example, to give a 10% discount, the value of deep_link_sub1 can be 10.

実装

UDL APIを選択したパラメーターと値に基づいて実装してください。

  1. 次を使用してください: subscribeForDeepLink() メソッド(から AppsFlyerLib)登録し DeepLinkListener インターフェイスリスナー
  2. コールバック関数をオーバーライドしてください onDeepLinking().
    onDeepLinking() 引数 a として受け入れます DeepLinkResult object.
  3. Use getStatus() to query whether the deep linking match is found.
  4. For when the status is an error, call getError() and run your error flow.
  5. For when the status is found, use getDeepLink() to retrieve the DeepLink object.
    The DeepLink オブジェクトには、ディープリンク情報とヘルパー関数が含まれており、よく知られているOneLinkキーから値を簡単に取得できます。 getDeepLinkValue().
  6. Use getDeepLinkValue() to retrieve the deep_link_value.
  7. Use getStringValue("deep_link_sub1") to retrieve deep_link_sub1. Do the same for deep_link_sub2-10 parameters, changing the string value as required.
  8. Once deep_link_value and deep_link_sub1-10 are retrieved, pass them to an in-app router and use them to personalize the user experience.

📘

注意

onDeepLinking は、アプリがバックグラウンドで動作していて、Application LaunchModeが標準でない場合には呼び出されません。

これを修正するには、アプリケーションが非標準の LaunchMode を使用している場合、setIntent(intent) メソッドを呼び出して、オーバーライドされたメソッド onNewIntent の中でインテント値を設定します。

import android.content.Intent;
...
...
...
@Override
protected void onNewIntent(Intent intent) 
{ 
  super.onNewIntent(intent);     
  setIntent(intent);
}

Code example

appsflyer.subscribeForDeepLink(new DeepLinkListener(){
            @Override
            public void onDeepLinking(@NonNull DeepLinkResult deepLinkResult) {
                DeepLinkResult.Status dlStatus = deepLinkResult.getStatus();
                if (dlStatus == DeepLinkResult.Status.FOUND) {
                    Log.d(LOG_TAG, "Deep link found");
                } else if (dlStatus == DeepLinkResult.Status.NOT_FOUND) {
                    Log.d(LOG_TAG, "Deep link not found");
                    return;
                } else {
                    // dlStatus == DeepLinkResult.Status.ERROR
                    DeepLinkResult.Error dlError = deepLinkResult.getError();
                    Log.d(LOG_TAG, "There was an error getting Deep Link data: " + dlError.toString());
                    return;
                }
                DeepLink deepLinkObj = deepLinkResult.getDeepLink();
                try {
                    Log.d(LOG_TAG, "The DeepLink data is: " + deepLinkObj.toString());
                } catch (Exception e) {
                    Log.d(LOG_TAG, "DeepLink data came back null");
                    return;
                }
                // An example for using is_deferred
                if (deepLinkObj.isDeferred()) {
                    Log.d(LOG_TAG, "This is a deferred deep link");
                } else {
                    Log.d(LOG_TAG, "This is a direct deep link");
                }
                
                // ** Next if statement is optional **
                // Our sample app's user-invite carries the referrerID in deep_link_sub2
                // See the user-invite section in FruitActivity.java
                if (dlData.has("deep_link_sub2")){
                    referrerId = deepLinkObj.getStringValue("deep_link_sub2");
                    Log.d(LOG_TAG, "The referrerID is: " + referrerId);
                } else {
                    Log.d(LOG_TAG, "deep_link_sub2/Referrer ID not found");
                }
                // An example for using a generic getter
                String fruitName = "";
                try {
                    fruitName = deepLinkObj.getDeepLinkValue();
                    Log.d(LOG_TAG, "The DeepLink will route to: " + fruitName);
                } catch (Exception e) {
                    Log.d(LOG_TAG, "Custom param fruit_name was not found in DeepLink data");
                    return;
                }
                goToFruit(fruitName, deepLinkObj);
            }
        });
AppsFlyerLib.getInstance().subscribeForDeepLink(object : DeepLinkListener{
            override fun onDeepLinking(deepLinkResult: DeepLinkResult) {
                when (deepLinkResult.status) {
                    DeepLinkResult.Status.FOUND -> {
                        Log.d(
                            LOG_TAG,"Deep link found"
                        )
                    }
                    DeepLinkResult.Status.NOT_FOUND -> {
                        Log.d(
                            LOG_TAG,"Deep link not found"
                        )
                        return
                    }
                    else -> {
                        // dlStatus == DeepLinkResult.Status.ERROR
                        val dlError = deepLinkResult.error
                        Log.d(
                            LOG_TAG,"There was an error getting Deep Link data: $dlError"
                        )
                        return
                    }
                }
                var deepLinkObj: DeepLink = deepLinkResult.deepLink
                try {
                    Log.d(
                        LOG_TAG,"The DeepLink data is: $deepLinkObj"
                    )
                } catch (e: Exception) {
                    Log.d(
                        LOG_TAG,"DeepLink data came back null"
                    )
                    return
                }

                // An example for using is_deferred
                if (deepLinkObj.isDeferred == true) {
                    Log.d(LOG_TAG, "This is a deferred deep link");
                } else {
                    Log.d(LOG_TAG, "This is a direct deep link");
                }

                try {
                    val fruitName = deepLinkObj.deepLinkValue
                    Log.d(LOG_TAG, "The DeepLink will route to: $fruitName")
                } catch (e:Exception) {
                    Log.d(LOG_TAG, "There's been an error: $e");
                    return;
                }
            }
        })

⇲ Github リンク:Java