How to Use Deep Linking in Your Mobile App

Development iOS Android Marketing

Deep linking enables app creators to drive user engagement and simplify the app onboarding process. It’s useful in tracking referrals and determining which campaigns are most effective, as well as identifying best practices for making apps more useful and accessible.

This article discusses what deep linking is, how it can be used, and what services are available to help simplify and enhance deep linking for your app. It also talks about how Apple and Google plan to improve usability and increase discovery in iOS and Android through deep links.

What is deep linking?

A deep link is a URL that opens and directs a user to a specific location within an app. When a developer creates an app, they can register a URL scheme with iOS. For example, in our app Agenda, we registered "agenda" as the app's URL scheme, so any URL that starts with agenda:// will deep link to the app. In this case, when iOS attempts to open a URL with a custom scheme, it first looks through the apps that are installed on the device to see if any installed app has registered that URL scheme. If it finds a match, then it will launch the app and pass in the URL that was used to open it. For example open Safari and type twitter:// into the the search/address field and press Go. If Twitter is installed on your phone, the app will launch, otherwise Safari will try to load the address.

Deep links can help you open an app, but what else can they do? Not only can an app be launched by using a deep link, it can also act on any information that is contained in that URL. This is where deep linking starts to get really useful. For example, the following URL will open the Facebook app to the our profile page:

fb://profile/133913376661217

Why use deep linking?

Deep linking is important because it drives user engagement. Deep links can direct users to specific views within your app or other apps. Say you wanted your user to go from a view in your app straight to your company's Facebook page. Without deep linking the Facebook app, you have two options. The first is to display a button for the user to tap on that launches Safari or UIWebView within your app. Once they arrive at the Facebook page, they may need to authenticate with Facebook if they're not already signed in. The second option is to direct your user to exit your app, open the Facebook app, and then search for your company's page. Alternatively, you can make it easy for them and let a deep link do all the heavy lifting. With a single action the user can tap on the button and directly launch Facebook to your company's profile page.

You can also use deep linking to attract new users to your app. Instead of expecting a new or potential user to move from a browser to the app store and conduct their own search for your app, you can use a deep link to direct them straight to a specific screen in your app. This gives you more control over your app's marketing and onboarding process. We use deep linking to enhance the onboarding experience for our customer FamilySignal, by sending personalized invitations via deep links. When a user opens the link and FamilySignal launches, they are greeted with a personalized view with some registration information pre-populated to make the sign up process seamless.

What's more, deep linking can provide details about how users open or install your app. Your app can be opened or installed through deep linked ads, user-to-user content sharing via SMS, email, or social media, or through in-app referrals. If using a deep link service that supports deferred deep linking, you can attribute your referral campaigns, content sharing, and in-app referrals to the services, users, and campaigns that helped users find and use your app.

Deferred deep linking, for when deep linking isn't enough

Deep linking is a powerful tool when the app already exists on a user’s device. But what happens if a user doesn't have the app installed on their device? Let’s use our app Agenda to help us walk through this scenario. If a user attempts to open a deep link with the URL of agenda:// and the user does not have the app installed, iOS will attempt to open the URL using Safari since it could not find an app to open. This will result in Safari displaying an alert view, telling the user that it could not open the requested page. This is obviously a situation you want to avoid.

This is where an advanced form of deep linking called deferred deep linking comes in. Rather than simply having a user attempt to open a URL such as agenda://, we can send the user another URL that can first try to open the app on the user’s device and if that does not work, redirect the user to the App Store to install the app.

When a user downloads and opens Agenda for the first time, we run into another issue, which is that by default Agenda will not know that it has been opened by a deep link. This is due to the fact that the App Store does not pass the referral link that the user used to arrive at the App Store to the app that was installed. Fortunately, there are ways around this and there are several deep link service providers that help solve this problem with deferred deep links. A small amount of code will need to be added to your iOS app to contact the deep link provider and fetch the deferred deep link that was used to install the app. Once this is in place, you can safely send users deep links and they will be able to open or install then open your app and the original deep link will be available for your app to use.

Choosing a deep linking service

We looked into deep linking services while redesigning the onboarding process in FamilySignal. Many of these services let you create a link through the service's web interface and assign parameters that can be passed into an app opened through the deep link URL.

We decided to use Branch.io since it is easy to set up, offers comprehensive documentation, and does not require the user to sign into any third-party services. Branch.io works for existing and new app installations. It's cross-platform, supporting Android, iOS, and several other platforms. Branch.io is free. They plan to monetize through a future discoverability product. We hope they stick around, since reconfiguring our deep links through another service is a frustration we'd like to avoid.

Another deep linking service to note is Deeplink. This service works much like Branch.io and also supports both iOS and Android. In addition their translation rules help migrate changes between different versions of your apps and APIs. Translation rules are nice to use as an app grows and changes to keep these changes from breaking new or existing installations. Their documentation is lacking, however, and their customer service team isn't the most responsive. Deeplink uses a pay per click pricing model.

Google's App Invites Beta offers something slightly different. This service requires a user to log in to their Google account. Once logged in, Google asks the user which contacts they would like to send an invite to. The contacts are pulled from the device’s address book and other Google services, such as Gmail. A link is sent to the user and when they select it the app either opens or goes to the app store. App Invites Beta is free, Android and iOS compatible, and works well with Google Analytics. It is still in beta, however, with weak documentation and the added requirement of having to log in to a Google account to access it.

With any of these services, it is probably a good idea to configure your apps so that you can use the deep link service you selected or fall back to a more basic solution to guard against the service discontinuing or getting acquired in the future.

App Indexing and Universal Links

Google's App Indexing allows your Android or iOS (currently available in limited release) app content to surface in Google search results. When someone has your app installed and searches on Google, App Indexing will show your app in relevant search results. It then deep links back to that relevant content.

With iOS 9, Apple is introducing universal links, a new way to use deep links with apps. Universal links differ from the deep links we discussed above in that they will not require a developer to register a custom URL scheme when creating an app. Rather, universal links will use the existing URL to your app’s homepage. Your development team will need to perform some minor configuration on your web-sever so that the iOS app can confirm it is communicating with your website, but this work is minimal and once complete, it gives the users of your app a more simple, flexible, private, and secure way to launch and communicate with your app.

In addition, configuring universal links in your app will allow it to participate in Spotlight searches. These searches will show relevant content from your app along with the standard search results we see today when using iOS 8. For more details, check out this MacStories article.

Concluding Note

Deep linking is an important tool for app creators looking to enhance user engagement, improve the onboarding process, determine which campaigns drive users to an app, or simply trying to make their apps more useful. We'd love to hear about your own experiences. Tweet us or drop us a line on our contact page.

Cody Kimberling is an iOS developer for Savvy Apps who enjoys finding simple solutions to complicated problems. When not coding, he can be found hanging out with his two dogs, riding bikes, or playing the guitar.

You made it this far so...