Your marketing team may want to run various marketing campaigns to promote your apps. For example, they may create google ads, facebook campaigns, Instagram campaigns or use ads on other popular websites. These can all turn out to be expensive for the organization. Marketing teams would want to know which of these campaigns yield better results for them so that they can fine tune their marketing strategy. Hence they would want to be able to track which sources lead to more app installations.

To track the source of android application installations we can use different UTM parameters for different sources. (UTM parameters are short text codes that you add to URL (or links) to help you track the performance of web page or campaign)

The dynamic links feature in firebase supports this. Firebase allows us to create dynamic links which have the UTM parameters embedded in them. We can generate a unique link for each source that the marketing campaign targets. This way, we will know which source results in more app installations.

We have to add dynamic link support to our android app to make use of this feature.

The app can also get the URL from which the app installation was invoked and hence can get access to the UTM parameters for any further processing.

The UTM parameters can be sent to analytics engines like google analytics for marketing reports.

Firebase pushes the UTM parameters to google analytics. We can use this or we can also handle this in our application and use firebase dynamic link api to push the parameters to google analytics.

Add the dynamic link support to your android app

To add dynamic link support for the apps, we need to create a project in firebase. This can be done directly from Android Studio or from firebase console. I have explained the steps to do that using the firebase console.

Using Firebase console(Recommended):

  1. Sign in to firebase (console.firebase.google.com)
  2. Choose “Add project”
    1. Enter the name of the project
    2. Choose “Enable Google Analytics for this project”
      • Select the Google Analytics Account
    3. Create Project
  3. Click on android icon and enter your app details
  4. Download the config file and add it to the root directory of the android project
  5. Add firebase SDKs to your app(Follow the steps given in the firebase console)

After successful completion of the above steps, we can see our project in the firebase console.

Firebase Console → Select your project → Select Engage -> Dynamic links

Click on “Get Started”

This will prompt a screen which looks like:

Add URL prefix

Enter your brand domain or choose google provided domains and this will be used as the project information segment in Dynamic links. Once verification is completed, click on Finish.

Dynamic Links

For every new UTM link we want, we have to create a dynamic link here. Click on “New Dynamic link” button

Customize the short link URL

You can customize the short link URL. Click Next to set up a dynamic link.

Set up your dynamic link

Add the deep link URL. This is the URL to which the user will be redirected, if you choose “Open the link URL in a browser” in the next step.

Ex: https://play.google.com/store/apps/details?id=com.techpearl.akshara&hl=en_IN

Click Next to define behaviour for ios then android.

Define link behaviour for iOS

For ios you can choose the ios app configured for firebase else keep it as.

 Define link behaviour for Android

For android choose the Open deep link in your Android App, select your android app package from dropdown for which you want to use dynamic links.

If the app is not installed you can send the customer to google play store or custom URL(your website..)

Click Next to add Campaign tracking, Social tags to dynamic link which is optional but through this we can send the tracking parameters to google analytics for the app source tracking.

Campaign tracking, Social tags and Advanced Options

Firebase will send the campaign source, campaign medium, campaign name to google analytics account configured earlier.

Click on Create, you will be redirected to Dynamic links page with created URL as:

Dynamic links page with created URL

Now as we see there is an URL marked in the above screenshot : https://techpearl.page.link/m1cU

You can use this URL in your campaigns. When this URL is clicked in a mobile, this will launch the app, if installed or it will take the user to google play store link for the app or open a custom URL depending on the configuration.

If the URL is clicked on a non-android device, then the user will be redirected to the deep link URL configured.

Mobile Development

Implement the dynamic link call back in the android app

Add the following in MainActivity.java:

Implement the dynamic link call back in the android app

Ex: https://techpearl.page.link/?link=https://play.google.com/store/apps/details?id%3Dcom.techpearl.akshara%26hl%3Den_IN&apn=com.techpearl.akshara&utm_campaign=akshara-app-install&utm_medium=insta-bio&utm_source=instagram


If google analytics is configured in firebase, firebase will send the utm parameters to google analytics.

You can also parse the UTM parameters from the above link and take any custom action.

On default case firebase sends these events with UTM parameters to google analytics.

Firebase sends these events to google analytics

To view the above event data you can go to google analytics console-> All events -> click on any event name mentioned above dynamic_link_app_open-> you can see the data related to the above mentioned parameters.

To track the number of new app installations, checkout the dynamic_link_first_open event in google analytics.

Contact us to build applications which integrate seemlessly with Firebase.