How to shorten a Firebase Dynamic Link using my own domain name

9.9k views Asked by At

I'm trying to implement Firebase Dynamic Links in an iOS app. The goal is to have a clean URL for marketing purposes so folks can share links on social media. The idea is folks will share the clean URL that starts with my domain name.

When the app is installed following a click on that link, we want to be able to track who referred the app install by looking at the payload delivered by Firebase. I think this goal is similar to Firebase's use case to convert web users to mobile app users.

An example link I would like to provide for sharing on social media is: http://example.com/my-payload-here

I've tried several cases but I'm not able to get the behavior I'm looking for in any case. Has anyone implemented this successfully before?

Here is my test procedure:

  1. Uninstall the app
  2. Send the link to be tested in an iMessage to myself
  3. Tap the link on my iOS device (not using a simulator)
  4. Install the app from the App Store
  5. Launch the app after download completes by tapping "Open" button in the App Store

Below are my findings:

  1. Short link generated from the Firebase Console (https://xyz.app.goo.gl/ABCD) - Link opens in App Store. I install the app. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the payload is delivered.

  2. Long link identical to the "Long Dynamic Link" from the Firebase console for the link generated in #1 (https://xyz.app.goo.gl/?link=http://example.com/my-payload-here&isi=12345&ibi=com.example.MyApp) - behavior is identical to #1

  3. Short link using my domain (http://example.com/redirect/my-payload-here, configured to 301 redirect to URL in #2) - Opens in App Store. I install. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the link still goes to the App Store.

Some questions I have:

  1. Why isn't the payload delivered on the first launch for cases 1 and 2?
  2. How can we make this launch the app and deliver the payload instead of going to the App Store?

I've also consulted the Firebase flowchart for the deep link in case 2.

2

There are 2 answers

2
Alex Bauer On BEST ANSWER

This is not currently possible with Firebase. If you need whitelabeled URLs, you either need to build it yourself or use a more powerful link platform like Branch.io (full disclosure: I'm on the Branch team).

To answer your questions specifically:

  1. I have implemented Firebase Dynamic Links in a testbed app and can confirm that linking through installation the first time does work for both long and short URL variants. There is likely something wrong with your AppDelegate config, so we can take a look at that if you want to share code.
  2. Firebase does not support custom domains at this time. In theory (if you can solve the first issue above) you could get this working for first install by using a redirect like you have tried. However, you'll never be able to get it to launch the app with Firebase link data once the app is installed. This is because Universal Links work based on the domain of the link, and don't even request the web destination. Even if you enable Universal Links manually on your own domain, the app will open immediately without ever calling Firebase and the link data will never be set.
0
3netra On

Google Firebase team added support for custom subdomains to Dynamic Links.

  • You can now specify up to five custom page.link subdomains for your Dynamic Links. Short links using these new custom subdomains look like the following example: https://example.page.link/abcXYZ

  • Firebase Dynamic Link domains assigned on projects couldn't be deleted at this time.( firebase team is working on it.)

  • You can now whitelist the URL patterns that can be used as a Dynamic Link's deep link (link) or fallback link (ifl, ipfl, afl, ofl). If you define a whitelist, Dynamic Links won't redirect to URLs that don't match a whitelisted pattern.

  • You can try both of these features in the Firebase console.