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.
Configure your scheme name
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 set up deep linking, you need to choose a unique scheme name.
You can launch a specific activity when a user interacts with a deep link. To do this:
- Assign your scheme name to an activity in your
AndroidManifest.xml
file. - Add an
intent-filter
node to the activity definition. - Add an
android:scheme
data node containing your scheme name inside theintent-filter
node.
Example
This example shows how to set up an activity called MainActivity
to open with the scheme name adjustExample
.
Your app will now be able to handle URI schemes. When a user clicks a link with a deep_link
parameter containing your scheme name, this activity fires.
Configure Android App Links
Ensure that you configure your scheme name even if you’re setting up Android App Links for deep linking.
For Android App Links, add an intent
filter to your AndroidManifest.xml
file to specify which URLs your app can handle. Include the data
element with the android:autoVerify="true"
attribute in the intent
filter.
Your app will now be able to handle Android App Links. When a user clicks on a link containing the insights.go.link
domain, your app opens automatically.
Access deep link information
You can specify the delivery location of the deep_link
parameter content. To do this, set the android:launchMode
property on your activity in your AndroidManifest.xml
file.
The Adjust SDK delivers deep link information within your activity’s intent object using either the onCreate
or onNewIntent
method. You can access deep link content once the app is launched and one of these methods has fired. You can then access this information in other parts of your app.
Extract deep link information by calling the getData()
method within the onCreate
or onNewIntent
method.
Deferred deep linking
The Adjust SDK opens deferred deep links by default. No additional setup is required. If you want to disable this behavior, you need to set up a deferred deep link callback using the setOnDeeplinkResponseListener
method.
Set up a deferred deep link callback
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.
If you want to open the deep link, return true
in your delegate function. If you don’t want to open it, return false
.
Example
This example shows how to prevent the SDK from launching an activity by returning a false
value in your callback function.
Reattribution via deep links
Adjust enables you to run re-engagement campaigns with usage of deep links. For more information, check out how to set up Deep links in Campaign Lab.
To reattribute your user, you need to call the appWillOpenUrl
method when the app receives deep link content. The Adjust SDK then looks for new attribution data within the deep link. If the SDK finds new information, it forwards the information to Adjust’s servers for reattribution.
Link resolution
Some Email Service Providers (ESPs) use their own custom domains for marketing campaigns. If you need to measure clicks through a custom domain, you need to set the SDK up to resolve the link. To do this, call the resolveLink
method of the AdjustLinkResolution
class. The Adjust SDK will then follow the custom link and resolve it when opening the deep link. This ensures that you record the interaction with your email measurement campaign.
The resolveLinkWithUrl
method takes the following arguments:
url
(String
): the deep link that opened the application.resolveUrlSuffixArray
(String[]
): the custom domains of the configured campaigns that need to be resolved.adjustLinkResolutionCallback
(AdjustLinkResolutionCallback
): the callback that returns the final URL.
The method checks the deep link against the domains in the resolveUrlSuffixArray
. If it doesn’t find any matches, it forwards the deep link URL as is. If it does find a match, it attempts to resolve the link and return the resulting deep link. It then stores this in the callback parameter.
You can use the returned deep link to reattribute your user. To do this, pass the deep link to the Adjust.appWillOpenUrl
method.