You can configure deep linking in your app after you have set it up in the Adjust dashboard. Direct deep linking occurs when a user has your app installed on their device. The link takes the user to a specific page within your app.
To enable deep linking, you need to do the following:
- Enable Associated Domains for your app
- Configure your deep links in Xcode
Enable Associated Domains
To get started, you need to enable Associated Domains in your Apple Developer account. This allows you to set universal link domains in your app. To do this, follow these steps:
- Log in to your Apple Developer account.
- Select Certificates, IDs & Profiles in the left-hand menu.
- Select Identifiers in the left-hand menu.
- Find your app and select it to open the edit page.
- Ensure that Associated Domains is checked under Capabilities.
- Select Save to save your changes.
Configure deep links in Xcode
Follow these steps to add your deep link configuration to your Xcode project.
Adjust universal links domain
- Open your app project in Xcode.
- Select your project from the left-hand menu.
- Select your app under Targets.
- Select Signing & Capabilities from the top menu.
- Ensure that All is selected in the submenu below.
- Select the Add option (+) to add a capability.
- Select Associated Domains.
- Enter the Adjust Universal Link domain with the prefix
applinks:
- Here is an example using the
example.adj.st
domain:applinks:example.adj.st
.
- Here is an example using the
Custom URL scheme
- Open your app project in Xcode.
- Select your project from the left-hand menu.
- Select your app under Targets.
- Select Info from the top menu.
- Expand the URL Types section.
- Select the Add option (+) to add a URL type.
- Fill in the following information to create a URL scheme:
- Identifier:
$(PRODUCT_BUNDLE_IDENTIFIER)
- URL Schemes: Your custom URL scheme. This must be
unique. Don’t use protected schemes such as
http
,https
, ormailto
. - Role: Editor
- Identifier:
This scheme will work for your production and debug builds.
Modify your iOS app
You need to update your iOS app to set up different deep linking scenarios. How you update your app depends on whether your app uses scenes.
App doesn’t use scenes
If your app doesn’t uses scenes, you need to update methods in your app delegate.
Universal links
Update the application(_:continue:restorationHandler:)
method in your app delegate to call the following methods in the Adjust SDK:
ADJLinkResolution.resolveLink
: Call this method only if your marketing team requires the use of Adjust’s Link Resolution solution. If the deep link uses a domain that matches an element in theresolveUrlSuffixArray
, then the method attempts to resolve the deep link, and returns the resolved link. If the deep link doesn’t match an element in this array, then the method passes through the original deep link, so you can pass all deep links to this method.Adjust.appWillOpen
- Call this method to send deep links to Adjust’s servers to record information. You can pass both Adjust and non-Adjust deep links to this method. Adjust’s servers will ignore any deep links that don’t have Adjust parameters.
When a user clicks on your universal link, iOS opens your app and delivers the deep link to application(_:continue:restorationHandler:)
. This occurs whether the user has closed your app or has it running in the background.
Custom URL scheme
If your marketing team requires you to set up custom URL scheme deep links, update the application(_:open:options:)
method in your app delegate to call the Adjust.appWillOpen
method in the Adjust SDK. This method sends deep links to Adjust’s servers to record them. You can pass both Adjust and non-Adjust deep links to this method. Adjust’s servers ignore any deep links that don’t have Adjust parameters.
When a user clicks on your custom URL scheme deep link, iOS opens your app and delivers the deep link to application(_:open:options:)
. This occurs whether the user has closed your app or has it running in the background.
App uses scenes
If your app uses scenes, you need to update methods in your scene delegate.
Universal links
- Update the
scene(_:willConnectTo:options:)
method in your scene delegate. When a user clicks on your universal links and the user has your app closed, iOS opens your app and delivers the deep link to this method. - Update the
scene(_:continue:)
method in your scene delegate. When a user clicks on your universal links, and the user has your app running in the background, iOS opens your app and delivers the deep link to this method.
The above methods call the following methods in the Adjust SDK:
ADJLinkResolution.resolveLink
: Call this method only if your marketing team requires the use of Adjust’s Link Resolution solution. If the deep link uses a domain that matches an element in theresolveUrlSuffixArray
, then the method attempts to resolve the deep link, and returns the resolved link. If the deep link doesn’t match an element in this array, then the method passes through the original deep link, so you can pass all deep links to this method.Adjust.appWillOpen
- Call this method to send deep links to Adjust’s servers to record them. You can pass both Adjust and non-Adjust deep links to this method. Adjust’s servers ignore any deep links that don’t have Adjust parameters.
Custom URL scheme
- Update the
scene(_:willConnectTo:options:)
method in your scene delegate. When a user clicks on your custom URL scheme deep link and the user has your app closed, iOS opens your app and delivers the deep link to this method. - Update the
scene(_:openURLContexts:)
method in your scene delegate. When a user clicks on your custom URL scheme deep link, and the user has your app running in the background, iOS opens your app and delivers the deep link to this method.
These methods call the Adjust.appWillOpen
method in the Adjust SDK. This method sends deep links to Adjust’s servers to recordd them. You can pass both Adjust and non-Adjust deep links to this method. Adjust’s servers ignore any deep links that don’t have Adjust parameters.