April 18th, 2017
If you came here looking for a simple solution to the problem of tracking Universal Link clicks, let’s get the bad news out of the way: it is almost impossible to build yourself, because the ecosystem hasn’t caught up yet. Now the good news: there is a plug-and-play alternative that will get you up and running quickly, so go get started!
Anyone involved in marketing knows that tracking clicks is critically important. Whether you’re dealing with email links, web ads, or just social media shares, clicks signal user interaction and are usually the simplest way to tell if your efforts are producing results.
The first generation of mobile deep links hooked into this system by using a custom URI scheme (
myapp://) as the final URL at the end of this chain. This would launch the app, but with so many redirects, things sometimes broke down in the middle.
At some point in 2015, Apple decided that the old system of redirects no longer Just Works. This led to the introduction of Universal Links in iOS 9.
With Universal Links, apps verify their ownership of specific web domains. Whenever iOS sees a link from a domain that has a corresponding app installed, the web location isn’t even requested; instead, iOS immediately launches that app. If the first URL doesn’t match a verified domain, iOS won’t follow redirects to see if a later URL matches — it simply sends you to Safari.
In other words, the actual URL being requested the first time is the only thing that matters.
There are some real benefits to this approach: for users, no more redirect chains means everything is faster and smoother. There is also no way for apps to accidentally (or on purpose!) collide by claiming the same custom URI scheme, which will become ever more important as the mobile ecosystem continues to grow.
However, there is also a huge and very real problem: because link wrapping is now impossible, mobile click tracking has to be completely reinvented. This has left many apps with a terrible choice: either no more click tracking OR no Universal Links. And since Apple has blocked URI scheme deep linking to increase adoption of Universal Links, this is actually a choice between no click tracking and no deep linking at all.
Side note: the above also applies to Android App Links, which function exactly the same way. However, Android still allows custom URI schemes for deep linking, so the issue is less critical.
Fortunately, it IS possible to track clicks on Universal Links — it just requires a change in approach.
Previously, the last URL would be the “real one.” You could have one or more redirects to get there, but it was the final URL that handled both the app installed and app not installed situations.
With Universal Links, your first URL must be the “real one” because that’s the only place iOS will look. If the app is not installed, you can send the user somewhere else after the first URL loads with no restrictions (for example, to another click-tracking redirect before forwarding to the App Store page). However, if the app IS installed, it will open immediately and no further redirects are possible. This means you have to retroactively fake the click from inside the app.
In theory, you could do this by opening up a webview and actually “visiting” the attribution link URL. A more common approach is to fire off a postback request to a backend service, essentially saying “the app just opened via this Universal Link URL, meaning we know for sure that a click must have happened, so record one.” Branch uses a sophisticated implementation of the second option, and we seamlessly merge those Universal Link “clicks” with “normal” link clicks to provide a single, consolidated metric.
The bad news is neither attribution approach works unless your email system, ad network, etc., allows you to present an unwrapped directly link to the user, and link wrapping can collide with mobile apps in many ways. Here are a few of the more common use cases:
|Required Link Wrapping||Universal Links via Branch|
App Install Ads
|Technically no, but in practice yes||N/A (app not installed yet)|
Deep Linked Ads to Content
Since there is a huge infrastructure based on tracking via link wrapping, an equally huge refactoring will be necessary in order to accommodate the “upside down” tracking approach of Universal Links. Because of how many players are involved, this is one thing you can’t “just build for yourself” — you need a powerful friend with enough influence to convince third party providers to change the status quo.
Branch is your powerful friend.