adjust-icon

Deep linking

You can create deep links to take users to specific pages in your app. The Adjust SDK uses different logic depending on if the user already has your app installed on their device:

  • Direct deep linking: occurs if the user already has your app installed. The link takes the user to the page specified in the link
  • Deferred deep linking: occurs if the user doesn’t have your app installed. The link takes the user to a storefront to install your app first. After the user installs the app, it opens to the page specified in the link.

The SDK can read deep link data after a user opens your app from a link.

Set up deep linking

If a user has your app installed, it opens when they interact with a link containing deep link information. The Adjust SDK contains tools to parse deep link information for use throughout your app. To configure deep linking in your app, you need to choose a unique scheme name and assign it to a specified handler method. To do this:

  1. Open the Solution Explorer.
  2. Double click Package.appxmanifest to open the manifest designer.
  3. Select the Declarations tab.
  4. Select Available Declarations —> Protocol and select Add.
  5. Choose a name for your URI scheme. The URI scheme name must be lowercase.
  6. Press Ctrl+S to save your changes.

A screenshot of Package.appxmanifest configuration.

Next, you need to set up your OnActivated event handler. This handles the activated deep link event. To set this up, add the following to your your App.xaml.cs file:

App.xaml.cs
// ...
protected override void OnActivated(IActivatedEventArgs args) {
if (args.Kind == ActivationKind.Protocol) {
var eventArgs = args as ProtocolActivatedEventArgs;
if (eventArgs != null) {
// to get deep link URI:
Uri deeplink = eventArgs.Uri;
// ...
}
}
base.OnActivated(args);
}
// ...

Your app opens when a user interacts with a link containing your unique scheme name in the deep_link parameter. This value must be URL-encoded in the URL. The Adjust SDK delivers the result as unencoded text.

Deferred deep linking

Property declaration
public Func<Uri, bool> DeeplinkResponse { get; set; }

You can configure the Adjust SDK to call a delegate function when it receives a deferred deep link. This delegate function receives the deep link as a string argument. Once the SDK receives the deep link content from Adjust’s servers, it delivers it through this delegate function and expects a bool return value. This value represents whether the SDK should launch the OnActivated event handler.

var adjustConfig = new AdjustConfig(appToken, environment,
msg => System.Diagnostics.Debug.WriteLine(msg), LogLevel.Verbose);
adjustConfig.DeeplinkResponse = deepLinkUri =>
{
if (ShouldAdjustSdkLaunchTheDeeplink(deepLinkUri))
{
return true;
}
else
{
return false;
}
};
Adjust.ApplicationLaunching(adjustConfig);
// ...
Method signature
public static void AppWillOpenUrl(Uri uri);

To reattribute a user, you need to make an extra call to the Adjust SDK within your app. Add a call to the appWillOpenUrl(Uri, Context) method when the app receives deep link content. The Adjust SDK will then look for new attribution data within the deep link. If the SDK finds new information, it will forward it to Adjust’s servers for reattribution.

If the user needs to be reattributed due to clicking on an Adjust deep link, this triggers the attribution callback.

You must call Adjust.AppWillOpenUrl in the OnActivated method of your app:

using AdjustSdk;
public partial class App : Application
{
protected override void OnActivated(IActivatedEventArgs args) {
if (args.Kind == ActivationKind.Protocol) {
var eventArgs = args as ProtocolActivatedEventArgs;
if (eventArgs != null) {
Adjust.AppWillOpenUrl(eventArgs.Uri);
}
}
//...
}
}