How to shorten a Firebase Dynamic Link using my own domain name
<p>I'm trying to implement <a href="https://firebase.google.com/docs/dynamic-links/" rel="noreferrer">Firebase Dynamic Links</a> 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. </p>

<p>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 <a href="https://firebase.google.com/docs/dynamic-links/use-cases/web-to-app" rel="noreferrer">use case</a> to convert web users to mobile app users.</p>

<p>An example link I would like to provide for sharing on social media is: <a href="http://example.com/my-payload-here" rel="noreferrer">http://example.com/my-payload-here</a> </p>

<p>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?</p>

<p>Here is my test procedure:</p>

<ol>
<li>Uninstall the app </li>
<li>Send the link to be tested in an iMessage to myself </li>
<li>Tap the link on my iOS device (not using a simulator)</li>
<li>Install the app from the App Store</li>
<li>Launch the app after download completes by tapping "Open" button in the App Store</li>
</ol>

<p>Below are my findings: </p>

<ol>
<li><p><strong>Short link generated from the Firebase Console</strong> (<a href="https://xyz.app.goo.gl/ABCD" rel="noreferrer">https://xyz.app.goo.gl/ABCD</a>) - 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. </p></li>
<li><p><strong>Long link identical to the "Long Dynamic Link" from the Firebase console for the link generated in #1</strong> (<a href="https://xyz.app.goo.gl/?link=http://example.com/my-payload-here&amp;isi=12345&amp;ibi=com.example.MyApp" rel="noreferrer">https://xyz.app.goo.gl/?link=http://example.com/my-payload-here&amp;isi=12345&amp;ibi=com.example.MyApp</a>) - behavior is identical to #1</p></li>
<li><p><strong>Short link using my domain</strong> (<a href="http://example.com/redirect/my-payload-here" rel="noreferrer">http://example.com/redirect/my-payload-here</a>,  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. </p></li>
</ol>

<p>Some questions I have:</p>

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

<p>I've also consulted the <a href="https://abc123.app.goo.gl/?link=http://example.com/my-payload-here&amp;isi=1234&amp;ibi=com.example.MyApp&amp;d=1" rel="noreferrer">Firebase flowchart</a> for the deep link in case 2.</p>