Deep links are an incredibly useful tool for interacting with your customers outside of your app, and they provide a seamless experience in-app all the same. When you speak with customers outside of your app — on your website or through social media, for example — about a specific feature or product, you can create a little extra magic by referring people to the right spot in your app using deep links.

Implement deep links anywhere

Except in very specific circumstances, you can’t be fully sure that a user has your app on their device and can be deep-linked into it. If you want to use deep links in any context, you need to accommodate all users, regardless of whether they still have your app or not.

While there’s no direct way to check whether or not an app is present on a device, there is a sneaky way. Using a little JavaScript, you can “poll” your app by making the device try to access the deep link. When there’s a response, you know the app is installed and you’re able to send users over to the deep link. If there’s no response, you can instead send customers to the app store, to your website, or any other location that allows you to keep your customer in the loop.

You implement this script as a “race” of sorts. By asynchronously requesting both URLs, you give the deep link a little head start over the app store URL. If the deep link doesn’t respond, the app store link will win the race and redirect the user to the store.

The key is to do this subtly and unobtrusively. If you do it right, the logic will be executed quickly in the background. Don’t bother sending users to a browser page to execute this logic — that loses the magic.

Defer deep links

If the user uninstalled the app, now you can tell, and you can send them to the app store to download it again. Remember, though, that you just promised to show them something specific in the app. When they’ve just reinstalled the app, you need to fulfill that promise. Don’t lose the magic!

When you implement the fallback, this is a key part of the puzzle you’re solving before going to the app store. In this case, you’ll want to defer the deep link by remembering it and executing it even if the user must reinstall the app first. Once they open up the app again, you want to continue right where you left off, and send them directly where they want to go through the deep link.

To do this, you need a facility to pass data past the app store. On Android, use an install referrer that allows you to pass arbitrary data through the Google Play Store and then catch that in the app on the other side. This is an excellent opportunity to send the deep link and execute it with a request on the first open of the app.

Unfortunately though, this capability isn’t universally available, so on other platforms or app stores, the deep link needs to be remembered somewhere other than the device itself. You may want to place a server in the middle that can connect the initial deep link click to the reinstall and send the deep link to the app as soon as it’s reinstalled. The easiest way to do this is to match device or user IDs from the click to the install and have your app transmit these as soon as possible.

Once you match the user, you can simply send a message from your server to have the app reopen the deep link that brought them in.

Tracking deep links and what to expect

Finally, in order to know exactly how well you’re doing with the user experience, you’ll want to do some measurement. You’ll want to record the new “re-engagement,” stating which deep link brought a user in, what sort of creatives drove them to the deep link, what time that happened, and so on. Having done this, you can associate each re-engagement technique with specific results down the line — increased purchases, higher engagement, or whatever other goals you may be pursuing.

To analyze the effects that re-engagement has on users in aggregate, it’s best to regard re-engagement as an attribute of the user and not as a distinct event in the past. Once you’ve recorded this as an attribute, you can do any analysis further on.

Want to get really clever? Record exactly how the user arrived into your app by capturing whether or not the deep link was triggered when the user entered the app or deferred. Knowing the proportion of re-engaged users that came over the deep link gives you insights into whether you are managing to stay on the device or not. While you won’t know the exact number (for the lack of total population proportion and respective conversion rates), optimizing on the ratio between users who had to re-download and users who just hopped back into your app can be a great boon.

Measuring and understanding your re-engagement consistently across your entire marketing strategy is paramount to the business. This is an initial guide to getting started with magic deep link patterns, which will give your marketing organization greater insight into those key metrics – and, ultimately, result in improving the customer experience with your app.

Christian Henschel is cofounder and CEO of Adjust.