BT

Your opinion matters! Please fill in the InfoQ Survey!

Implementing and Searching Deep Links with the URX API

| Posted by John Milinovich Follow 0 Followers on Nov 28, 2014. Estimated reading time: 8 minutes |

Deep links are the solution to the one of the biggest limitations of native mobile apps - the inability to link directly to a specific place. URLs let us share the web with others, navigate directly to where we want to go, and easily connect web experiences together. These connections tell us how websites relate to each other and provide relevance needed to power search engines.

These links are sorely missed in mobile and we’re left with a poor navigation from app to app and a challenging search experience. Thanks in large part from support by Twitter, Facebook, and Google, deep link adoption is growing rapidly. Developers with deep links can drive traffic directly to the most relevant place in their app from push notifications, social networks, complementary apps, or advertising campaigns.

However the long term implications of deep links are broader than simple linking. When developers expose their app structure, we can organize the information inside apps in new ways and can create better ways to find information.

URX is building a knowledge graph that organizes the content inside apps and the actions they allow users to take. The URX App Search API lets you access this graph with specific details about the user’s context (e.g. keywords, intended action, location). The API then replies with deep links and other meta data of relevant apps that you can display to the user.

This article shares information on how to set up deep links in your app and provides details on how to use the URX platform to find deep links to other relevant apps.

Implementing deep links

A deep link is simply a link into a specific part, page, or state of a mobile app. It’s similar to a web URL that lets user navigate to a particular page in a website instead of the homepage.

  • Web URL: www.ebay.com/product123
  • iOS deep link: ebay://product123

Adding deep links to your app is platform specific. For Android apps, register the URL scheme in your manifest file. After you register your scheme, you need to map routes to in-app activities using intents. Intent filters can be added to your Android manifest file. Detailed information on how to add deep links to your Android app can be found in the Android Developer Portal.

For iOS apps, register the URL scheme in your project settings or in your info.plist file. Then implement the openURL method in your AppDelegate. You can either manually parse the URL in this method, or you can use Turnpike, our open-source framework, to map the URL to defined routes. You can find more information on adding deep links to your app in the iOS Developer Documentation.

When you are setting up your deep link structure there are a few things to keep in mind.

First, the syntax of your app deep links should match the URL structure of your web site if you have one. This makes it easier for you to send the user to your app and fallback to the website gracefully if they don’t have it installed.

Second, set up your app to handle query parameters. This will allow you to send data to your analytics system on things like traffic source. It will also allow you to pass in coupon codes to forms in your app.

Third, consider if you want to use deep links before someone has installed your app. Deferred deep linking is the ability to take someone to a specific page in your app directly after download. For example if a user clicks on a specific promotion but hasn’t yet installed the app, you would want send them to a specific page after the install. Android allows you to pass referral data through Google Play so it is relatively straightforward to set up. On iOS, you need to setup a redirect to the App Store through a click server to store the relevant information. More information on implementing deferred deep linking can be found on our blog.

Exposing Your Link Structure

After your app has deep links, you need to expose your deep link structure so that third parties can drive traffic to the relevant place inside your app. This is accomplished by adding tags to the <head> section of your website that identifies the deep links associated with that content.

Facebook, Google, and Twitter all provide tags that let you work with their services. Google App Indexing enables your Android app to show up in search results and Facebook App Links allows users to visit your app directly via a deep link if you have it installed. Google, Facebook, and Twitter are all highly motivated to understand your link structure to sell advertising campaigns targeted to re-engage existing users of your app.

Below are example App Links tags:

<meta property="al:ios:app_store_id" content="456788990" />
<meta property="al:ios:url" content="sample://page1" />
<meta property="al:ipad:app_store_id" content="234788990" />
<meta property="al:ipad:url" content="sample://page1" />
<meta property="al:android:package" content="com.sample.android" />
<meta property="al:android:url" content="com.sample.android" />
<meta property="al:windows_phone:url" content="sample://page1" />
<meta property="al:windows_phone:app_id" content="12345678-1234-1234-1234-123456789012" />

We expect most developers to integrate one or more of these third parties tags onto their site, just as most developers have allowed the Googlebot to crawl their website.

The URX App Search API

URX is building an app search engine for developers. We believe the search opportunity is bigger than any single app can take advantage of, so we opened up our knowledge graph

to developers to build into their own experience. In this section, we’ll cover how we build our index and walk through how to structure a query and interpret the results.

Creating our Index

Over the last two years, we built a web-scale crawler to index web pages that contain tags for either Google, Twitter, Facebook, or URX Links on your website. With the right tags in place we can extract:

  • Android deep link URI. For example, sample://page1
  • iOS URI. For example, sample://page1 (can be different from Android URI, but typically it’s similar)
  • iPad URI. For example, sample://page1 (can be different from Android URI, but typically it’s similar)
  • Android Play Store ID. For example, com.sample.android
  • iOS App Store ID. For example, 456788990

From there, we crawl the content of the page and associate it with the deep links. We also take advantage of any schema.org categorization on the page. In particular, we index actions as they are important to helping organize apps by actions they let user take (e.g. listen, watch, buy, etc).

Constructing a Query

Let’s walk through a sample search on our API. Let’s say you want to search for an app that lets you listen to Ellie Goulding. The query would be:

https://urx.io/ellie+goulding+action%3AListenAction

where “Ellie Goulding” is the keyword, and “ListenAction” represents the intended action. Note that if you submitted a simple text query for “Ellie Goulding”, you would pull all relevant content and actions pertaining to Ellie Goulding: music videos to watch, concert tickets to buy, articles to read, and songs to listen to.

Interpreting the Response

For the above query, the URX API returns a result that looks like:

The response contains multiple links, with the most relevant results at the top. The results are ranked based on their relevancy to the query, the relative popularity of the entries, and preferences of similar users.

Search results can contain multiple types of results like songs, and events. Every result has a name, description, image, and urlTemplate field that are guaranteed to have values. Additional fields are returned if the website or app has additional information available for that entity type.

Displaying the Result

URX gives developers complete flexibility to display the search results however you want to. In the example above, you could build a simple native card using the details found in the first JSON response body above.

Below is an example of a card layout for the query for a listen action of the song “Lights”.

In an iOS application, you would bind each of the variables above to a display element in a UIViewController. In an Android application, you would bind these to View elements within an Activity or a Fragment.

Resolve the user

URX gives you the opportunity to decide whether you want to direct your user to an app, an app install page, or a website. To do this you send a request to the URX resolution endpoint (https://beta.urx.io/) using the URL indicated by MusicRecording.potentialAction.target.urlTemplate. The Resolution endpoint returns a response containing three types of links:

  • The original web link
  • The deep link corresponding to the appropriate app.
  • The app installation URL for the user’s platform.

URX has SDKs with helper methods to allow you to easily send the user to the app if they have it installed and fallback to web.

Conclusion

Broad deep linking adoption will bring many of the benefits of the web to the mobile app experience. Developers need to implement deep links now to ensure they take advantage of new ways to be discovered and engage their users in the near future.

The URX App Search API is currently in beta - sign up here or view full documentation at developers.urx.com for more information.

About the Author

John Milinovich is a co-founder and CEO of URX, the first deep link search engine for developers. URX was a member of the Summer 2013 Y Combinator class and has raised $15 Million from Accel, Google Ventures, First Round Capital and several other top investors. Prior to URX, John was on the Google Analytics Developer Relations team where he helped drive adoption of the Analytics API across Google's developer ecosystem.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT