Three things I got wrong building deferred deep links after Firebase Dynamic Links
A week before our launch, I was doing one last end-to-end run in production. I opened one of our links once from a mobile browser. The dashboard said two clicks.
That number feeds everything: free-plan quotas, overage billing, the analytics people use to judge a campaign. If one tap counts twice, every customer pays for twice the traffic they got. We found it before anyone else did, but it made me go back over the whole flow. Here are the three mistakes that review turned up, and what iOS still can't do.
Why deferred deep links are hard
A normal deep link is easy: the app is installed, the OS hands it the URL, you route to a screen. A deferred deep link has to survive an install. Someone taps a link to a product page, has no app, gets sent to the App Store or Google Play, installs, and opens the app for the first time. Neither store passes the original URL through to the app on its own. Something has to remember the tap and hand it back on first launch.
Firebase Dynamic Links did that for a lot of apps. It shut down on August 25, 2025, and links on both page.link and custom domains now return 404. So a lot of people are rebuilding this piece, including us.
Mistake 1: Counting a tap twice
On mobile, our link first shows a small preview page with an "Open" button. We counted a click when the preview page was shown. Then the "Open" button sent the browser back to the same link, which redirected into the app or the store, and that request counted as a click too. One person, one tap, two clicks.
The fix was to decide which request is the click and treat everything after it as a continuation:
- Showing the preview page counts once.
- The "Open" hop only counts if it didn't come from that link's own preview page. If the Referer is our preview page for the same link, it's the same visit.
- Reopening the preview page in the same browser within two minutes doesn't count again.
- Bots don't count at all.
None of this is clever. The mistake was assuming one request equals one click when our own flow made two.
Mistake 2: Trusting a fingerprint on Android
Android has a real answer to "which tap led to this install": the Play Install Referrer. When you send someone to Google Play with a referrer parameter, the Play Store hands that value to the app after install. It's deterministic.
We used it, but we also kept a fallback that matched on network and device signals, and the fallback ran too often. An install from Play that nobody tapped a link for could still match a stranger's recent click from the same network, say an office Wi-Fi. That person then opened the app on someone else's link.
The rule now is simple: if Google Play installed the app, trust only the Install Referrer.
- Each click gets its own token in the Play referrer. We store only a hash of it, and it can be claimed once.
- A Play install with no token gets "no match". No guessing.
- Network and device matching only runs for builds installed some other way (Android Studio,
adb install, another store) or when the referrer can't be read.
Reading the referrer with Google's library is a few lines. Do it once, on first launch:
val client = InstallReferrerClient.newBuilder(context).build() client.startConnection(object : InstallReferrerStateListener { override fun onInstallReferrerSetupFinished(responseCode: Int) { if (responseCode == InstallReferrerClient.InstallReferrerResponse.OK) { val referrer = client.installReferrer.installReferrer // Look up the click token in `referrer`, once, then never again. } client.endConnection() } override fun onInstallReferrerServiceDisconnected() {} }) A related bug: we also confirmed installs by guessing which click they came from, which miscounted on shared IPs and missed people who switched networks. Now the deferred record carries the click's ID, so a match records the install directly.
Mistake 3: A store URL as the fallback
Every link has fallback URLs for when the app isn't installed. Our own docs showed setting the Android and iOS fallbacks to the store listing, which seems natural: no app, go install it.
But when a link had a fallback set, our code sent the visitor straight to that URL and skipped writing the record a deferred link needs. So the people most likely to install, the ones sent straight to the store, were exactly the ones who lost the link on first open. Now a fallback that points at a store is handled as a store redirect, and the deferred record gets written.
What iOS can and can't do
iOS has no Install Referrer. There is no store-provided way to know which tap led to an install, so on iOS a deferred deep link is a guess. Ours matches on the device type (phone or tablet) and OS, plus either the exact IP address within 48 hours, or the same /24 network and the same device language within 2 hours. No network match, no match. The SDK doesn't compute a device identifier.
That's good enough to open the right screen on first launch. It is not good enough to pay out a referral reward or link two accounts. On office or campus Wi-Fi it can pick up someone else's tap. Treat it as a hint.
The other iOS option is the pasteboard: copy the link on the web page, read it in the app. Since iOS 16, reading the pasteboard shows a system permission prompt, so reading it automatically on launch is a bad first impression. Check whether there's likely a link first, and read only when the user taps something.
If you build it yourself
- Decide which request is the click. Everything after it in the same visit is a continuation.
- On Android, if Play installed the app, use the Install Referrer and nothing else. No token, no match.
- Give each click its own referrer token, store only a hash, and let it be claimed once.
- Make sure a fallback to a store URL still writes the deferred record.
- On iOS, use a match to route a screen, not to grant rewards or link accounts.
- Keep matching data short-lived. Ours is deleted after 48 hours, and visitor IDs are keyed with a secret that rotates monthly.
I work on Grivn, a deep link service built after Firebase Dynamic Links shut down: https://www.grivn.com/?utm_source=devto&utm_medium=article&utm_campaign=devto-01