Firebase Dynamic Link to track : App Installs, First-Open , Reopen Inside the app and consume Custome Events

1.5k views Asked by At

I'm using firebase dynamic link in my app. I've a two part quetsion.

  1. How to know in the app if its a fresh install done using Dynamic Link? Is there a way I can get these events in my app " dynamic_link_app_open, dynamic_link_first_open," which the document says are automatically tracked by Firebase analytics and Google Analytics?

    All i want is to ask firebase if this dynamic has lead to a fresh install or just a app reopen. I'm using this code for getting the deeplink.

     FirebaseDynamicLinks.getInstance()
            .getDynamicLink(intent)
            .addOnSuccessListener(
                this
            ) { pendingDynamicLinkData ->
                // Get deep link from result (may be null if no link is found)
                var deepLink: Uri? = null
                if (pendingDynamicLinkData != null) {
                    deepLink = pendingDynamicLinkData.link
                    Log.d("Firebase pendingDynamicLinkData", pendingDynamicLinkData.toString())
                    Log.d("Firebase deepLink ", deepLink.toString())
                // Handle the deep link. For example, open the linked
                // content, or apply promotional credit to the user's
                // account.
            }
            .addOnFailureListener(this)
            { e -> Log.w("Firebase", "getDynamicLink:onFailure", e) }
    }
    
  2. Custom Params: Is this the correct way to do it

    What I'm doing in my app is adding custom params like customParam1 and customParam2 in the deep link while generating DynamicLink from the Firebase console. like this

    enter image description here

And then in my app when I try to get the deep link using val deepLink = pendingDynamicLinkData.link I get back this deep link that I generated along with the customParam1 and customParam2 and I'm able to extract them from my URI and perform the needful action.

My question is simply, is this the correct/standard way to do the task?

1

There are 1 answers

0
Anukool srivastav On

I have found solution to get these event from Dynamic Link Callback in Android.

Posted answer here.

https://stackoverflow.com/a/67732296/4148323