Firebase Dynamic Links are smart URLs that work across platforms. They open your app if installed, redirect to the app store if not, and preserve link context through the installation process.
Note: Service Deprecation
Firebase Dynamic Links was deprecated in 2023. Existing links continue to work, but new projects should consider alternatives like Branch.io, Adjust, or native deep linking (Universal Links/App Links).
Key Takeaways
- 1Dynamic Links work on iOS, Android, and web
- 2Context is preserved through app installation
- 3Use your own domain with Firebase Hosting
- 4Links can be created via Console, REST API, or SDK
- 5Consider alternatives for new projects (Branch, Adjust, native)
Dynamic Link Structure
A Firebase Dynamic Link contains all the information needed to route users to the right destination on any platform. The base URL points to your Firebase domain, while query parameters specify the deep link destination and platform-specific handling instructions.
https://example.page.link/?link=https://example.com/product/123&apn=com.example.app&isi=123456789&ibi=com.example.appThe table below explains the core parameters. The link parameter is the actual deep link your app will receive—everything else controls routing behavior on different platforms.
| Parameter | Description |
|---|---|
link | The deep link URL your app handles |
apn | Android package name |
ibi | iOS bundle ID |
isi | iOS App Store ID |
afl | Android fallback URL |
ifl | iOS fallback URL |
ofl | Desktop fallback URL |
Now let's look at the complete set of parameters available for fine-tuning behavior on each platform.
All URL Parameters
Dynamic Links support many parameters for controlling behavior across platforms. You will typically use a subset of these—the app parameters for basic routing, and social parameters when the link will be shared.
App Parameters
These parameters control which app opens and what happens when the app is not installed. At minimum, you need the package name (Android) or bundle ID (iOS) for your app.
| Parameter | Platform | Description |
|---|---|---|
apn | Android | Package name (required for Android) |
amv | Android | Minimum version code |
afl | Android | Fallback URL if app not installed |
ibi | iOS | Bundle ID (required for iOS) |
isi | iOS | App Store ID for install redirect |
imv | iOS | Minimum version number |
ifl | iOS | Fallback URL if app not installed |
ipfl | iOS | iPad-specific fallback URL |
Social Meta Parameters
When users share your Dynamic Links on social media or messaging apps, these parameters control the preview card that appears. Setting these ensures your shared links look professional and informative.
| Parameter | Description |
|---|---|
st | Social title (for link previews) |
sd | Social description |
si | Social image URL |
With the parameters understood, let's look at how to create Dynamic Links in your application code.
Creating Dynamic Links
You can create Dynamic Links in several ways: manually constructing URLs, using the Firebase REST API to generate short links, or using the Firebase SDK in your app. We will cover each approach.
Manual URL Construction
The simplest approach is building the URL programmatically. This works well for server-side generation where you have full control over the parameters.
function createDynamicLink(options) {
const {
domain, // Your page.link domain
link, // Deep link URL
androidPackage,
iosBundle,
iosAppStoreId,
title,
description,
imageUrl
} = options;
const url = new URL(`https://${domain}/`);
// Required: the deep link
url.searchParams.set('link', link);
// Android
if (androidPackage) {
url.searchParams.set('apn', androidPackage);
}
// iOS
if (iosBundle) {
url.searchParams.set('ibi', iosBundle);
}
if (iosAppStoreId) {
url.searchParams.set('isi', iosAppStoreId);
}
// Social preview
if (title) url.searchParams.set('st', title);
if (description) url.searchParams.set('sd', description);
if (imageUrl) url.searchParams.set('si', imageUrl);
return url.toString();
}
// Usage
const link = createDynamicLink({
domain: 'example.page.link',
link: 'https://example.com/products/123',
androidPackage: 'com.example.app',
iosBundle: 'com.example.app',
iosAppStoreId: '123456789',
title: 'Check out this product',
description: 'Amazing deals on example.com'
});This function uses the URL API to build the link, which automatically handles encoding of special characters in parameter values. The resulting URL can be quite long, which is where the REST API comes in.
REST API (Short Links)
Long Dynamic Links can be unwieldy for sharing. The Firebase REST API converts long links into short, memorable URLs that redirect through Firebase's servers.
async function createShortDynamicLink(longLink, apiKey) {
const response = await fetch(
`https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=${apiKey}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
longDynamicLink: longLink,
suffix: { option: 'SHORT' } // or 'UNGUESSABLE' for longer suffix
})
}
);
const data = await response.json();
return data.shortLink;
}
// Returns: https://example.page.link/abc123The API returns a short link like example.page.link/abc123. You can choose between SHORT (4 characters) or UNGUESSABLE (17 characters) suffix options depending on your security needs.
Handling Links in Your App
Once you have created Dynamic Links, your app needs to handle them when users tap. The Firebase SDK provides methods to retrieve the deep link that triggered the app open, including deferred deep links that survived the app installation process.
Android (Kotlin)
On Android, use the Firebase Dynamic Links SDK to retrieve the link in your main Activity. This works whether the app was already installed or was just installed from the Play Store.
// In your Activity
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener { pendingDynamicLinkData ->
val deepLink: Uri? = pendingDynamicLinkData?.link
deepLink?.let {
// Handle the deep link
val productId = it.getQueryParameter("productId")
navigateToProduct(productId)
}
}
.addOnFailureListener { e ->
Log.e("DynamicLinks", "Error: ", e)
}The getDynamicLink call returns the full deep link URL, which you then parse to extract route parameters. Handle both success and failure cases to avoid crashes when links are malformed.
iOS (Swift)
On iOS, Dynamic Links are delivered through Universal Links. You handle them in your AppDelegate or SceneDelegate, depending on your app's architecture.
// In AppDelegate or SceneDelegate
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if let incomingURL = userActivity.webpageURL {
DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { dynamicLink, error in
guard error == nil else { return }
if let deepLink = dynamicLink?.url {
// Handle the deep link
self.handleDeepLink(deepLink)
}
}
}
return true
}The Firebase SDK's handleUniversalLink method extracts the deep link from the Dynamic Link wrapper. Your handleDeepLink function then routes to the appropriate screen based on the URL path and parameters.
Modern Alternatives
Since Firebase Dynamic Links is deprecated, you should consider alternatives for new projects. The right choice depends on your needs—native deep linking for maximum control, or third-party services for attribution and analytics.
| Solution | Best For | Pricing |
|---|---|---|
| iOS Universal Links + Android App Links | Native apps, free | Free |
| Branch.io | Full-featured deep linking | Free tier + paid |
| Adjust | Attribution + deep linking | Enterprise pricing |
| AppsFlyer | Marketing attribution | Enterprise pricing |
For most apps, native Universal Links (iOS) and App Links (Android) provide reliable deep linking without third-party dependencies. Check out our dedicated guides for each platform linked below.
Try the URL Builder
Use our Firebase Dynamic Link template to build links interactively. You can experiment with different parameters and see how the URL structure changes.