Deep Linking Terpadu (Unified Deep Linking/UDL)

Alur UDL

  1. SDK dipicu oleh:
    • Deferred Deep Linking - menggunakan API khusus
    • Deep Linking Langsung - dipicu oleh OS melalui Tautan Aplikasi Android, Tautan Universal iOS, atau skema URI.
  2. The SDK triggers the OnDeepLink metode, dan meneruskan objek hasil deep link ke pengguna.
  3. The OnDeepLink metode ini menggunakan objek hasil deep link yang menyertakan deep_link_value dan parameter lain untuk menciptakan pengalaman yang dipersonalisasi bagi pengguna, yang merupakan tujuan utama OneLink.

Lihat dokumen Deep Linking Terpadu untuk Android dan iOS.

Pertimbangan

  • Membutuhkan AppsFlyer Android SDK V6.1.3 atau versi lebih baru.
  • Tidak mendukung kampanye SRN.
  • For new users, the UDL method only returns parameters relevant to deferred deep linking: deep_link_value and deep_link_sub1-10. Jika Anda mencoba mendapatkan parameter lain (media_source, kampanye, af_sub1-5, dll.), mereka kembali null.
  • onAppOpenAttribution tidak akan dipanggil. Semua kode harus dimigrasikan ke OnDeepLink.
  • OnDeepLink harus dipanggil setelahnya initSDK.
  • AppsFlyer.cs harus dilampirkan ke objek game.

Penerapan

  1. Tempel AppsFlyer.cs skrip ke objek game dengan kode init AppsFlyer. (AppsFlyerObject)
  2. Call initSDK with the this parameter in order for the OnDeepLinkReceived callback to be invoked:
    AppsFlyer.initSDK("devkey", "appID", this);
    
  3. Tetapkan OnDeepLink to AppsFlyer.OnDeepLinkReceived pada Start()
     AppsFlyer.OnDeepLinkReceived += OnDeepLink;
    
  4. Setelah initSDK() menerapkan OnDeepLink.

Contoh

using AppsFlyerSDK;

public class AppsFlyerObjectScript : MonoBehaviour
{
  void Start()
  {
    AppsFlyer.initSDK("devkey", "appID", this);
    AppsFlyer.OnDeepLinkReceived += OnDeepLink;
    AppsFlyer.startSDK();
  }
  
  void OnDeepLink(object sender, EventArgs args)
  {
      var deepLinkEventArgs = args as DeepLinkEventsArgs;

      switch (deepLinkEventArgs.status)
      {
          case DeepLinkStatus.FOUND:

              if (deepLinkEventArgs.isDeferred())
              {
                  AppsFlyer.AFLog("OnDeepLink", "This is a deferred deep link");
              }
              else
              {
                  AppsFlyer.AFLog("OnDeepLink", "This is a direct deep link");
              }
              
              // deepLinkParamsDictionary contains all the deep link parameters as keys
              Dictionary<string, object> deepLinkParamsDictionary = null;
      #if UNITY_IOS && !UNITY_EDITOR
              if (deepLinkEventArgs.deepLink.ContainsKey("click_event") && deepLinkEventArgs.deepLink["click_event"] != null)
              {
                  deepLinkParamsDictionary = deepLinkEventArgs.deepLink["click_event"] as Dictionary<string, object>;
              }
      #elif UNITY_ANDROID && !UNITY_EDITOR
                  deepLinkParamsDictionary = deepLinkEventArgs.deepLink;
      #endif

              break;
          case DeepLinkStatus.NOT_FOUND:
              AppsFlyer.AFLog("OnDeepLink", "Deep link not found");
              break;
          default:
              AppsFlyer.AFLog("OnDeepLink", "Deep link error");
              break;
      }
  }
}