How To Track and Attribute Universal Links

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!

How To Track Universal Links: Simple Option
    1. Sign up for a free Branch account.
    2. Integrate the free Branch SDK on your platform (iOS, Android, Cordova, Xamarin, Unity, Air ANE, Titanium, and React Native are all available).
    3. Send click data to any of Branch’s Data Integrations partners, build your own custom webhook, or just view the numbers right in the Branch Dashboard.

Click Tracking and Link Wrapping

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.

Since the earliest days of the internet, click tracking meant wrapping the original URL inside another URL and adding a HTTP or Javascript redirect. HTML can present all this to users as the original URL if desired, but behind the scenes, the browser first loads the click tracking destination before being quickly forwarded to the actual URL. With so many tools available, things sometimes get taken to extremes: a user might be bounced through half a dozen pages before arriving at their final destination.

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.

Enter Universal Links

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.

Tracking Universal Link Clicks

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.

Click Tracking and Apps

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

Yes Yes

Email Links

Yes Yes

URL Shorteners

Yes Yes

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.