Skip to content

Firebase Dynamic Links: Cross-Platform Deep Links That Survive Install

DodaTech Updated 2026-06-28 5 min read

In this tutorial, you will learn about Firebase Dynamic Links: Cross. We cover key concepts, practical examples, and best practices to help you master this topic.

Firebase Dynamic Links are smart URLs that route users to the most relevant content in your app or website, adapting to platform, install status, and link preferences.

What You'll Learn

How to create Dynamic Links, handle deep linking in web and mobile apps, configure link behavior for different platforms, track link performance, and use analytics attribution.

Why It Matters

Traditional deep links break when the app isn't installed. Dynamic Links survive the install flow — the user installs the app, opens it, and sees the intended content. DodaTech uses Dynamic Links for referral campaigns and threat alert sharing.

Real-World Use

A user receives a threat alert notification with a Dynamic Link. If the app is installed, it opens to the threat details. If not, the link opens the Play Store, and after install, opens the correct screen.

flowchart LR
    A["Dynamic Link\nCreated"] --> B{"App Installed?"}
    B -->|Yes| C["Open App\nDeep Link"]
    B -->|No| D["Play Store /\nApp Store"]
    D --> E["Install App"]
    E --> F["Open Deep Link\nAfter Install"]
    C --> G["Show Content"]
    F --> G
    style A fill:#dbeafe,stroke:#2563eb
    style C fill:#bbf7d0,stroke:#16a34a
    style F fill:#fef3c7,stroke:#d97706
const admin = require("firebase-admin");

async function createThreatLink(scanId, threatName) {
  const link = await admin.dynamicLinks().createLink({
    longDynamicLink: "https://dodatech.page.link",
    dynamicLinkInfo: {
      domainUriPrefix: "https://dodatech.page.link",
      link: `https://dodatech.com/threats/${scanId}`,
      androidInfo: {
        packageName: "com.dodatech.antivirus",
        fallbackLink: "https://play.google.com/store/apps/details?id=com.dodatech.antivirus"
      },
      iosInfo: {
        bundleId: "com.dodatech.antivirus",
        appStoreId: "123456789",
        fallbackLink: "https://apps.apple.com/app/durga-antivirus/id123456789"
      },
      socialMetaTagInfo: {
        socialTitle: `Threat Alert: ${threatName}`,
        socialDescription: "A security threat was detected on your device",
        socialImageLink: "https://dodatech.com/images/threat-alert.png"
      }
    }
  });

  console.log("Dynamic Link created:", link);
  return link;
}

createThreatLink("scan_abc123", "Trojan.Generic");
// Expected output: Dynamic Link created: https://dodatech.page.link/abc123
import { getDynamicLink } from "firebase/dynamic-links";

// Handle incoming dynamic links
async function handleDynamicLink() {
  const dynamicLink = getDynamicLink();
  if (dynamicLink) {
    const link = dynamicLink.link;
    console.log("Dynamic link received:", link);

    // Parse link and navigate
    const scanId = link.split("/threats/")[1];
    if (scanId) {
      navigateToScan(scanId);
    }
  }
}

// On app startup
handleDynamicLink();
// Create shorter links for sharing
const { default: fetch } = await import("node-fetch");

async function createShortLink(longLink) {
  const response = await fetch(
    "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=YOUR_API_KEY",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        longDynamicLink: longLink,
        suffix: { option: "SHORT" }
      })
    }
  );

  const data = await response.json();
  console.log("Short link:", data.shortLink);
  return data.shortLink;
}
// Expected output: Short link: https://dodatech.page.link/xyz
// Get link stats from Firebase Console
// Analytics tab shows:
// - Total clicks
// - App installs
// - First opens
// - Re-opens
// - Platform breakdown (Android, iOS, Web)
// - Geographic distribution

async function getLinkStats(linkId) {
  // Firebase Console > Dynamic Links > Analytics
  console.log("View link analytics at:");
  console.log(`https://console.firebase.google.com/project/durga-antivirus/dynamiclinks/${linkId}/analytics`);
}

Common Mistakes

1. Not Testing on Fresh Installs

Dynamic Links after install need end-to-end testing. Use a device that doesn't have the app installed to verify the full install-then-open flow.

2. Missing Fallback URLs

Without fallback URLs, users without the app see a blank page. Always provide fallback URLs for both Android and iOS.

3. Incorrect Domain URI Prefix

The domain prefix must match the configured domain in Firebase Console. Mismatched prefixes cause link creation failures.

Dynamic Links may arrive during cold start (app not running). Handle the link event both in the app initialization and as a separate event listener.

5. Ignoring Social Preview Tags

Links shared on social media without preview tags look generic. Set socialMetaTagInfo to show title, description, and image in shared previews.

Practice Questions

  1. How do Dynamic Links survive app installation?
  2. What is the difference between long and short Dynamic Links?
  3. How do you configure platform-specific behavior for a Dynamic Link?
  4. How do you track Dynamic Link performance?

Answers:

  1. The link redirects to the Play/App Store for install. After installation, the Google Play Services or iOS reads the pending link and passes it to the app.
  2. Long links are full URLs with query parameters. Short links are compressed versions (20-30 chars) for sharing. Both resolve to the same behavior.
  3. Set androidInfo and iosInfo in the link payload with package/bundle IDs and fallback URLs for each platform.
  4. Firebase Console > Dynamic Links > Analytics shows clicks, installs, opens, and platform breakdown for each link.

Challenge: Build a Dynamic Links system for threat alert sharing: create a link with threat details as deep link data, configure Android/iOS fallbacks, shorten for SMS sharing, and handle the link on cold start to navigate to the threat report.

FAQ

Are Dynamic Links free?

Dynamic Links are free to create and use. You pay for the custom domain if using a custom domain prefix.

What is the difference between Dynamic Links and regular deep links?

Regular deep links only work if the app is installed. Dynamic Links work regardless — they redirect to the app store for install, then continue to the deep link content.

How long do Dynamic Links last?

Dynamic Links never expire. They remain valid indefinitely once created.

Can I use Dynamic Links in email campaigns?

Yes. Dynamic Links work in any context — email, SMS, social media, QR codes. The link behavior adapts to the platform.

How do I test Dynamic Links locally?

Use the Firebase Test Lab or create a link and test on a physical device. The Firebase Emulator Suite doesn't support Dynamic Links testing.

Mini Project

Build a Dynamic Link system: create links for each threat alert (with social preview), configure Android/iOS/web routing, shorten for SMS sharing, handle deep link navigation on app launch, and track link analytics in Firebase Console.

What's Next

Firebase Remote Config — change app behavior without deploying updates.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro