Get Started With Analytics For Android - Firebase
Get Started With Analytics For Android - Firebase
Events: What is happening in your app, such as user actions, system events, or errors.
User properties: Attributes you de ne to describe segments of your user base, such as language preference or geographic
location.
Prerequisites
Add the dependency for Google Analytics for Firebase to your app-level build.gradle le:
compile 'com.google.firebase:firebase-core:11.8.0'
Log events
Once you have created a FirebaseAnalytics instance, you can use it to log either prede ned or custom events with the logEvent()
(https:// rebase.google.com/docs/reference/android/com/google/ rebase/analytics/FirebaseAnalytics.html#logEvent(java.lang.String,%20android.os.Bu
ndle))
method. You can explore the prede ned events and parameters in the FirebaseAnalytics.Event
(https:// rebase.google.com/docs/reference/android/com/google/ rebase/analytics/FirebaseAnalytics.Event) and FirebaseAnalytics.Param
(https:// rebase.google.com/docs/reference/android/com/google/ rebase/analytics/FirebaseAnalytics.Param) reference documentation.
https://firebase.google.com/docs/analytics/android/start/ 1/2
25/12/2017 Get Started with Analytics for Android | Firebase
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
MainActivity.java (https://github.com/ rebase/quickstart-android/blob/master/analytics/app/src/main/java/com/google/ rebase/quickstart/analyti
Con rm Events
You can enable verbose logging to monitor logging of events by the SDK to help verify that events are being logged properly. This
includes both automatically and manually logged events.
This command displays your events in the Android Studio logcat, helping you immediately verify that events are being sent.
Next Steps
See your data refresh periodically in the Firebase console (//console. rebase.google.com/).
Explore the guides on logging events (https:// rebase.google.com/docs/analytics/android/events) and setting user properties
(https:// rebase.google.com/docs/analytics/android/properties).
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/),
and code samples are licensed under the Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0). For details, see our Site Policies
(https://developers.google.com/terms/site-policies). Java is a registered trademark of Oracle and/or its a liates.
https://firebase.google.com/docs/analytics/android/start/ 2/2