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
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
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):
- Sign in to firebase (console.firebase.google.com)
- Choose “Add project”
- Enter the name of the project
- Choose “Enable Google Analytics for this project”
- Select the Google Analytics Account
After successful completion of the above steps, we can see our project in the
Firebase Console → Select your project → Select Engage -> Dynamic links
Click on “Get Started”
This will prompt a screen which looks like:
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.
For every new UTM link we want, we have to create a dynamic link here. Click on “New Dynamic link” button
You can customize the short link URL. Click Next to set up a 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.
Click Next to define behaviour for ios then android.
For ios you can choose the ios app configured for firebase else keep it as.
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.
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:
Now as we see there is an URL marked in the above screenshot :
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.
Implement the dynamic link call back in the android app
Add the following in MainActivity.java:
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.
To view the above event data you can go to google analytics
All events -> click on any event name mentioned above dynamic_link_app_open->
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.