How to Set Up Deferred Deep Linking

I have universal links configured for my iOS app which work as expected when the app is installed. When the app is not installed the universal link will go to the browser as expected.

What I want to do is redirect to the app store, allow the user to install the app, then redirect them to the initial universal link. Redirecting them to the app store isn't the hard part I can achieve that from the webpage, however I don't know how to save a reference to that initial link to redirect them once they instal the app.

What I want the flow to be for a user who doesn't have the app is:

  1. visit a universal link (example.com/UUID)
  2. redirect to the app store and install the app
  3. open the app and redirect to example.com/UUID

I've seen some ways people are doing this with the clipboard but I don't love that solution, I also don't want to use a 3rd party service if I can avoid it - how are the 3rd party services making this happen?

Thank you for sharing your post. Let me clarify if I understand your problem and workflow correctly. You have a Universal Link with a referral ID. When the app is not installed, the Universal Link opens the App Store. However, after the app is installed on the device and the user taps the “Open” button after installation, the Universal Link no longer has the referral ID?

To my understanding, when a user clicks on a link that corresponds to your app’s domain, iOS attempts to launch your app if it is installed. If the app is not installed, a smart banner prompts the user to install it.

  • After App Installation:
    • When the user opens your app after installation, iOS will call the application(_:continue:restorationHandler:) method in your app delegate if the original Universal Link was handled by the system.
  • In the App Delegate:

By following these steps, the user will be redirected to the App Store to install your app after clicking on the Universal Link when the app is not installed. Once the app is installed, the user will be redirected to the specific content within the app based on the Universal Link. Do you lose your referral ID in the URL at that point?

I am very interested in learning the entire workflow from both my own and others’ perspectives.

Smart Banner: https://developer.apple.com/documentation/webkit/promoting-apps-with-smart-app-banners

Albert Pascual
  Worldwide Developer Relations.

Hi Albert, thanks for the explanation!

To me it reads like your explanation is geared towards the campaign referrals that I can setup in AppStore Connect > Analytics > Campaigns. Those allow you to check how many users clicked on a referral link but since the link will be the same for multiple users, it's not applicable here.

I think the original question was more related towards uniquely identifying a user that clicked on a link, installed the app and then opened it.

E.g. assume the following example:

  • you have a website with a forum like this one here and also support an app.
  • A user without your app is reading up on a discussion (which has a disucssion_id) and then decides to click on a link you provide on the same page.
  • The link directs to the app store.
  • The link to the App Store would contain the discussion_id.

Once the user installed the app I would like the app to forward the previous discussion_id in the first install session. Since the discussion_id will be dynamic it does not look like a good fit for a referral link.

The documentation for the smart banner you shared allows to provide URLs but those only seem to be respected if the user has the app already installed, i.e. they get ignored if the user must first install the app.

Do you know of any way to achieve deferred deep linking like I described with the dicussion_id example?

Thanks!

How to Set Up Deferred Deep Linking
 
 
Q