Migrate from URL Shortener to Firebase Dynamic Links

Migrate from URL Shortener to Firebase Dynamic Links


##  What is the Google URL Shortener?

The Google URL Shortener was announced in 2009 and allowed you to shorten a link via Goo.gl before sharing it with others. This provided a few benefits:

Allows you to track how many times your link has been clicked Allows other app developers to take advantage of our API and use our endpoint (which processes and shortens links for us)

Google URL Shortener offered both free and paid features such as adding landing page insights, custom branded tracking domains, etc., which we're not going to cover in this guide. While still available today, it's being phased out by Firebase Dynamic Links over the coming months.

Thanks again for subscribing! Be sure to check your email for future updates.

Google URL Shortener


##  What is Firebase Dynamic Links? Why is it better than the Google URL Shortener?

Firebase Dynamic Links (FDL), currently in beta, has been released to replace Google Cloud Messaging (GCM). FDL allows you to create and manage links that can be used across multiple platforms without requiring developers to create platform-specific implementations of their own. This means that if a developer wants their application to open an app, they don't have to build a link shortener into iOS and one for Android – instead, they just point users who click on a deep link from their app back to the correct version of the app at a single endpoint ( e.g., https://fir-fl-lynsfwxiy .appspot.com/open?link=https://google.com ).

Additionally, FDL links allow developers to provide custom schemes (for example: myapps:// ) which gives huge flexibility to link management in terms of security and use cases. Unlike the Google URL Shortener, Firebase Dynamic Links are not limited to 7 or 15 characters like other services. This means that you can create long-lived links for deep linking purposes (see below for example).

Finally, unlike the Google URL Shortener, Firebase Dynamic Links do not include any advertising strings attached so you can be sure that your user's data is kept private when using this service.

For a detailed list of the advantages over using Google URL Shortener, read the blog post announcing Firebase Dynamic Links.

##  How do I migrate from Google URL Shortener to Firebase Dynamic Links?

Before you start migrating links from Goo.gl to FDL, it's important to note that link tracking will no longer function unless you update your application to point users who click on deep links from your app back to your website via a browser rather than sending them directly into internal app content or making an in-app purchase. For more information about how Firebase Dynamic Links work and how they impact apps built with both Android and iOS – please see their documentation .

The steps below can be followed any developer spinning up their app for the first time or switching away from the Google URL Shortener.   

         1) Delete all existing Goo.gl API keys

Before you start migrating to FDL, you should delete any current API keys that are associated with your project in order to avoid creating new links using old keys. You can do this by following these steps:

Go to Google Cloud Console Select Project -> Billing Click on APIs & Services -> Library Search for "Goo.gl" and click on it's name If you have any "API enabled" checkboxes next to services, uncheck them - if not, skip this step Closest to the top of your screen should be a section labeled "Public API Access" - click on the cog next to that section Click on Delete API Access - it may say "Delete All Viewer Data" depending on your Google Cloud Console version Click on Delete

You can also remove any keys at https://console.cloud.google.com/apis/credentials  if you have more than one project associated under your Google Account. You can always add a new key, but removing an existing key will prevent a future FDL link from being automatically created with old keys.

         2) Get a Firebase Dynamic Links Service account

Next, sign up for a service account from Firebase here . This account is going to be used to create your own FDL links specifically for the domain(s) you are using.

Confirm the email address you used on your project - this account will be associated with all of your FDL links on https://console.firebase.google.com .

         3) Install the Firebase command line tools

You can install the Firebase CLI tool by following these steps:

Open Terminal or Command Line Type npm install -g firebase-tools and hit Enter Login into your existing account (e.g., if you sign up as [email protected] , log in to that email) Logout of an existing account (e.g., use logout ) Log back in using another email (e.g., use login [email protected] ) You should now see the firebase command in your terminal.

This step is required because you need to authenticate the Firebase CLI tool before it can communicate with your service account and start creating FDL links.

         4) Create a custom domain for Firebase Dynamic Links

The next step is to create a custom domain specifically for Firebase Dynamic Links by following these steps:

Sign into https://console.firebase.google.com using your newly created service account Select "Hosting" on the left side menu Click on the red Add Project button (it may be grayed out if you already have another project associated with this Google Account) Type in a name of the project Select your country/region and click on Continue You should now be on the "Project Overview" page. Click on the gear icon next to your project name and select Project Settings Next, click on the red Add Firebase Domain button toward the top right Select a Country/Region to associate with this Custom Domain Enter a domain name for this service account (e.g., links.<domain>.com ) - you can use any unique part of your website without special characters If using a custom domain, select what type of DNS record should point users here (to ensure proper analytics tracking, you'll need to choose CNAME) You should now see https://<your custom domain> listed under "Custom Domains" On the left navigation menu underneath "Hosting", click on "Settings" Scroll down until you see the "Domains" section and click on "+ Add domain" You should now see your custom domain listed under "Domains" - click on it to expand this section      The final step is to create a CNAME record for your custom domain. This will ensure Firebase Dynamic Links properly tracks analytics data (e.g., users who clicked on links, passed referral traffic, etc.). To do this, follow these steps:

Go back to your https://console.firebase.google.com project Home page Select the gear icon again Next, select Project Settings On the left navigation menu underneath "Hosting", choose Domain management Scroll down until you see the "Custom domains" section and click on the "+ Add domain" button Fill out the form with your custom domain name and select a type of record (e.g., CNAME) Save this record

If you use a third-party DNS provider, follow their instructions for adding a CNAME record to associate your custom domain.


We are social