Unified Deep Linking (UDL)
UDL privacy protection
For new users, the UDL method only returns parameters relevant to deferred deep linking:
deep_link_value
anddeep_link_sub1
todeep_link_sub10
. If you try to get any other parameters (media_source
,campaign
,af_sub1-5
, etc.), they returnnull
.
UDL flow
- The SDK is triggered by:
- Deferred Deep Linking - using a dedicated API
- Direct Deep Linking - triggered by the OS via Android App Link, iOS Universal Links or URI scheme.
- The SDK triggers the
OnDeepLink
method, and passes the deep link result object to the user. - The
OnDeepLink
method uses the deep link result object that includes thedeep_link_value
and other parameters to create the personalized experience for the users, which is the main goal of OneLink.
Check out the Unified Deep Linking docs for Android and iOS.
Considerations
- Requires AppsFlyer Android SDK V6.1.3 or later.
- Does not support SRN campaigns.
- For new users, the UDL method only returns parameters relevant to deferred deep linking:
deep_link_value
anddeep_link_sub1-10
. If you try to get any other parameters (media_source, campaign, af_sub1-5, etc.), they returnnull
. onAppOpenAttribution
will not be called. All code should migrate toOnDeepLink
.OnDeepLink
must be called afterinitSDK
.AppsFlyer.cs
must be attached to the game object.
Implementation
- Attach
AppsFlyer.cs
script to the game object with the AppsFlyer init code. (AppsFlyerObject) - Call initSDK with the
this
parameter in order for theOnDeepLinkReceived
callback to be invoked:AppsFlyer.initSDK("devkey", "appID", this);
- Assign
OnDeepLink
toAppsFlyer.OnDeepLinkReceived
inStart()
AppsFlyer.OnDeepLinkReceived += OnDeepLink;
- After
initSDK()
implementOnDeepLink
.
Example
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;
}
}
}
Updated 3 months ago