Google Searching and Linking into Your iOS app with Universal Links
Chaise Hocking@ChaiseHock
What is App Indexing?
Why do we need this?
Where have we seen it being used?
• Improved user experience
• Continued logged in state
• Potential for customer interaction
What do these apps gain from App Indexing?
Demo App
https://venuesnearby.com/venue/4b058744f964a5209d8722e3
https://venuesnearby.com/search?term=melbourne
Deep Link vs Universal Link
Deep Link
venuesnearby://search?term=melbourne
custom scheme
• mailto://[email protected]
• tel://1-408-555-5555
Issues with Deep Links
• Cannot open when app is not installed
• Can only be shared (email etc.)
Universal Link (iOS 9 +)
own domain
https://venuesnearby.com/search?term=melbourne
• App and website share the same link
• If app is not installed, follows the link to website
Universal Links resolve the issues of Deep Links
• Can be shared or returned in web search
• Can be distributed around the web
How do I setup App Indexing for my app?
Step 1: Satisfy Prerequisites
a. iPhone app
b. iPhone app supports routes
c. Mobile or Desktop website
Step 2: Link your app with your website AppName.entitlements
<plist version=“1.0"> <dict> <key>com.apple.developer.associated-domains</key> <array> <string>applinks:venuesnearby.com</string> <string>applinks:www.venuesnearby.com</string> </array> </dict></plist>
Step 3: Link your website with your app
{ "applinks": { "apps": [ ], "details": [ { "appID": "KADQL6585N.com.shinetech.venuesnearby", "paths": [ "/venue/*", "/search*" ] } ] }}
Step 4: Serve your association file
https://<domain>/apple-app-site-association
https://<domain>/.well-known/apple-app-site-association
• content-type: application/json
• Mustn’t be behind a redirect
• Must use an ssl certificate from a certificate authority
www.google.com/apple-app-site-association
So we’re setup…
What next?
On app installation
• The iOS fetches the apple-app-site-association file from each associated domain
• Periodically fetches file in-case of updates
/apple-app-site-association
Your WebServer
On link press
• The iOS checks each of it’s installed apps, if it has a matching domain and path
• If one matches, then it will open the link in the corresponding app
• Passes the link through to the app for action
https://venuesnearby.com/venue/4b058744f964a5209d8722e3
"paths": [ "/venue/*", "/search*" ]
"paths": [ "/venue/*", "/search*" ]
"paths": [ "/venue/*", "/search*" ]
"paths": [ "/venue/*", "/search*" ]
"paths": [ "/venue/*", "/search*" ]
So how does this help me search my app?
Some challenges, tips and common pitfalls
Challenge: Deploying locally
• Associated domain becomes your local instance of your website
• You need to serve your local website over ssl
• You must use a certificate from a certificate authority
• iOS 10 minimum
• Send the link in an iMessages
• Tap the link
Tip: Testing on the Simulator
Pitfall: Robots.txt
Allow: /apple-app-site-association
Pitfall: Device user-agent
swcd (unknown version) CFNetwork/758.2.8 Darwin/15.0.0
"paths": [ "*"]
"paths": [ "/venue/*", "/search*"] ✔
• Only allow urls your app can actually support
Tip: Defining your paths
Allow All URLs Restrict to known URLs
✘
Challenge: Limitations to path matching
• Cannot include fragments in paths
• Cannot include query parameters in paths
• Test your links in Google search response• Confirm request / response from apple-app-site-association
Tip: Debug with Charles
In Summary
• Why we should use Universal Links
• Seen it in action
• The steps to set up Universal Linking
• Some debugging advice
Thanks
iOS app https://github.com/chaisehocking/VenuesNearby
mobile web app https://github.com/chaisehocking/VenuesNearbyMWeb