Universal link after installing app wont open from Safari - ios

Senario: User scans a QR code with a unique universal link into our app to "redeem" their code.
They scan the code which goes to a webpage with a link to download the app.
The user downloads the app.
Returns to the web page and there is a link within the page which is the same link as the QR code.
We assume tapping the (same) URL would trigger the universal link but it does not.
The universal link works fine from email or other apps (after its been installed)
How can we fix this bad UX, is there a HTML component or redirect we need to consider when tapping the basic link on the Web page. How can we make the link initiate the "deeplink" into the app now its installed. The banner at the top is displayed but its not the ideal flow.
The user cannot scan the QR code again - they must go through the download and "reopen" app in one flow.

Universal links do not trigger in Safari. This is intentional behavior confirmed by Apple engineers in the forums (sorry, don't have a link right now). Their reasoning: if you're already in the browser eco-system you usually do not want to be redirected to an app, but want to stay in the browser.
What you can do is have your app implement a custom URL scheme, and your web page can then check if your custom URL scheme is supported and open it.

Related

UITextView: Tapping a universal deep link that should lead to the SAME app, opens the fallback URL in Safari

I have a Branch.io universal deep link that displays a product page in my app, or the equivalent website page if the app is not installed.
When tapping the link from other apps such as WhatsApp or Notes, the link works. My app is launched and immediately displays the correct product.
However, if a user uses my own app's messaging platform to pass this link to another user as a text message, the message is displayed in my app using a UITextView, and tapping the link from this UITextView always launches the fallback URL in Safari.
Only when switching back from Safari to my app, the deep link handler is called and the link is then handled correctly.
I would like my app to handle its own deep links immediately even if they are tapped from within the app itself, without launching Safari. Does anyone knows how to achieve this behavior?
Deep links are an incredibly important part of delivering a high quality user experience. With deep links, you can take users to the exact thing they clicked on or even offer a customised on-boarding experience.
You can auto-route within app without launching safari browser, please follow this link for detailed implementation:
https://docs.branch.io/deep-linking/routing/#option-3-use-branchs-easy-config-deep-link-routing
Feel free to write to support#branch.io in case you have other doubts.

Google Analytics for Email Tracking when using Universal Links on iOS

I would like to track button clicks in emails using Google Analytics. Let's say I would like the button to have a Universal Link, which when clicked, will open an iOS app directly with no browser redirect. (https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html)
However, if my URL is a Universal Link, i.e. www.xyzxyz.com/openApp?campaign=promo&source=email, and an email recipient clicks the link from their iPhone with the installed app, no call is made to the server, and therefore the click is not tracked.
Has anyone experienced a way of tracking Universal Link clicks?
Universal Links are handled on the frontend by the device without ever interacting with a server if the app is installed. The AASA file is stored on the device at install and allows the device to check whether the link can open the app before passing the link onto safari. If the app is not installed and the link is passed onto Safari then the Google analytics tags will be processed. The only way to accomplish this is to send the GA request from the app if you register that a Universal Link was clicked.
I recommend looking into a deep linking service like Branch. They have a Google analytics data integration that will handle all of this tracking for you.

How to open iOS app when user scans a QR Code with an URL in it

I want to create a QR Code that contains a URL like https://example.com in it and when an user scans that, if they have the app installed on the phone, to open the app instead of going to the browser. Is that possible? I've looked at App Links and Universal Links and I can't see to get it to trigger off of a QR Code or with HTTPS instead of some custom URL.
Scanning QR code containing a URL with standard Camera app results in prompt to open the link in Safari. If the link in question is Universal Link and you do have the associated app installed, the prompt shows your app instead of Safari. If a user taps on that prompt your app is brought to foreground and application(_:userActivity:restorationHandler:) is called. It seems like it's not documented anywhere, but most likely it's an intended behavior and it's definitely working.

Universal Links opened in unsupported apps, are they completely lost?

I am trying to implement Branch marketing links in my app. I want for example to be able to create a link to share with users that will route them to a particular screen in the app. I noticed from the Branch docs that for some apps the link just opens the app store and not the actual app (even if it is installed). Being based in Asia I have the feeling that most of our customers will be wanting to share the link via an unsupported app such as Line. If a user is redirected to the app store via the link and then taps “open app”, what happens? Is the link meta data lost? Does the meta data only remain if the link is opened in an app such as mail or notes?
Alex from Branch.io here:
This list in the Branch documentation gives a partial list of apps that support Universal Links, but unfortunately it is not complete. We've tried to cover the most common apps.
Line is using a custom webview (not SFSafariViewController). It doesn't support Universal Links for the initial click, but this is one of the edge cases where Branch can detect the originating app and do some custom behavior. For Line, we trigger your app's URI scheme. This means the behavior your users see when clicking a Branch link from within Line is the same as Universal Links, even though Universal Links isn't actually the protocol being used.
If you want to handle other apps where Branch doesn't have a workaround like this, you could try enabling the deepviews feature. This will cause the link to open a content preview with a button to launch the app (or forward to the App Store if not installed).
When a user with the app already installed clicks the Open button on the App Store page, all the meta data is preserved and they will still be deep linked. Branch doesn't know (or care!) what happens between when the user clicks the link and the app launches, so that gives you plenty of flexibility.
Universal Links have some restrictions - not from Branch but from Apple's implementation. One of these restrictions is Universal Links cannot be opened from SFSafariViewController.
From Branch's docs, Line is not explicitly mentioned but other popular messaging apps may be of interest. I don't have Line myself but whether Line launches websites in it's own browser or the Safari app may give you a clue.
Facebook Messenger - works conditionally
WeChat - works conditionally
Twitter - works conditionally
LinkedIn - works conditionally
Any app using SFSafariViewController - works conditionally

iOS Universal Link App Store redirect

I have universal links working correctly, when the app is installed I see how the link opens the app, and when it's not installed opens the url in safari.
Actually what I would like to do is to redirect and go to the app store, so users can download the app directly.
Im going to include a redirect on the html file, because I know universal links don't support redirects a the http server config level (anyway I think this is for the manifest file only, apple-apps-site-association)
Anyone can confirm if this is the right way to do it, or the only way to do it? I don't like the idea to open safari first, load my html (with the redirect only) and then go to the store. Looks like there's no easier way to do it.
You're right: server-side redirects aren't allowed for the apple-app-site-association file. However, I believe once the user opens a Universal Link and (assuming the app is not installed) lands on the URL, all options are on the table (server-side, or otherwise).
If the page on the other end of your Universal Links URL contains an instant JS redirection to your app's App Store page, that should work just fine. Something like this:
window.location = 'itms-apps://itunes.apple.com/us/app/imdb-movies-tv/id342792525'
But yes, no matter how you do it, Safari is still going to open. It'll flash past so quickly that the user likely won't even notice. Here's a real-time recording I just made of the Branch.io deep linking service's demo app doing exactly this process:
From here: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
"When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari."
You're not doing it wrong, that's just how they work.

Resources