I have a simple task: I want to track the referral id of an app install and pass it to backend.
What I did: I created a link with an extra parameter referrer
It is better and more reliable to track referrer via Firebase Dynamic Link.
Below this how it work.
https://domain/?link=your_deep_link&apn=package_name[&amv=minimum_version][&ad=1][&al=android_link][&afl=fallback_link]
Here's the example of link after fill in the parameters.
https://example.app.goo.gl/?link=https://www.example.com/someresource&apn=com.example.android&amv=3&al=exampleapp://someresource&ibi=com.example.ios&isi=1234567&ius=exampleapp
Of course, you can shorten the link to something like https://example.app.goo.gl/abcde
directly at Firebase console. It will take only few minutes to setup the Dynamic Link.
Then in the Android app on your main Activity
you can call AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false)
to retrieve link information.
More information can be found here https://firebase.google.com/docs/dynamic-links/