Here is my source code of MainActivity
private void initializeFirebaseAnalytic() {
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
firebaseAnalytics.setAnalyticsCollectionEnabled(true);
firebaseAnalytics.setMinimumSessionDuration(500);
}
AFAIK your events events only send if you builded apk is in release mode.
you can send an event like this:
FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(App.getInstance());
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, action);
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, label);
mFirebaseAnalytics.logEvent(category, bundle);
Make sure to download the config file (google-services.json) file from the firebase console and put it in your project (app/ folder).Also you can use the firebase assistant for doing all the configurations needed automatically.After that you could use logEvent() method to send event to the firebase dashboard.
Related
I am making a game, in Java for Android.
Here is the code:
Bundle bundle = new Bundle();
bundle.putLong(FirebaseAnalytics.Param.VALUE, count);
bundle.putString(FirebaseAnalytics.Param.VIRTUAL_CURRENCY_NAME, "Coins");
bundle.putString(FirebaseAnalytics.Param.LEVEL, level);
analytics.logEvent(FirebaseAnalytics.Event.EARN_VIRTUAL_CURRENCY, bundle);
Here is what I get in the table:
error_value: "currency"
firebase_error: 19
Everything worked until recently, but now I can not register this event.
Google documentation tells that both parameters VIRTUAL_CURRENCY_NAME and
VALUE are optional.
Another event, SPEND_VIRTUAL_CURRENCY, gets registered without any problems.
What's wrong?
In this manual Get started with Google Analytics there is a section "Start logging events":
Java code
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Kotlin code:
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM) {
param(FirebaseAnalytics.Param.ITEM_ID, id)
param(FirebaseAnalytics.Param.ITEM_NAME, name)
param(FirebaseAnalytics.Param.CONTENT_TYPE, "image")
}
Questions:
Confusing between FirebaseAnalytics.Event.SELECT_CONTENT in Java the code and FirebaseAnalytics.Event.SELECT_ITEM in the Kotlin code.. The both parameters are different (SELECT_CONTENT vs SELECT_ITEM). Webpage about events: https://firebase.google.com/docs/analytics/events is Service Unavailable.
When I go to the: Firebase -> Analytics -> Events -> select_content: there is: Events in last 30 minutes. I cannot list of all events. I don't see the values of selected event.. I don't see all the select_content events includes values.
I tried to create custom dimension in Custom definitions, I waited 24 hours and I still don't know where to see the event.
Do you know, how to show all Events with values reported by FirebaseAnalytics.Event.SELECT_CONTENT ? Like in old Firebase before update? This is image of the old Firebase select_content:
The new Firebase logging events is not clear at all to me.
Similar post with unaswered good question:
Do you mean that you can get report for some type of select_content event by item_id? Did you try this?
I am trying to see which parts of my app are most used, for this I have added a logEvent like this:
Bundle bundle= new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "action");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "screen_a");
FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event,VIEW_ITEM, bundle);
The events get logged and I can see in my Dashboard under Events section a view_item entry with the Count, however, when I enter it, I can see the counts, meaning values, but I can't see any values like "screen_a" or "screen_b"...
Since these are not custom events, shouldn't the values be available in the dashboard?
I got the same question as you. By asking email to firebase team, they replied the exact method to watch the log of item_name. Below are the example, I logged an ITEM_NAME "action_getProVersion" with ECOMMERCE_PURCHASE event:
log event in your codes: (You have done this)
Bundle bundle = new Bundle();
//bundle.putString(FirebaseAnalytics.Param.ITEM_ID, itemId);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "action_getProVersion");
//bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ECOMMERCE_PURCHASE, bundle);
On the firebase event screen, press on the right side,for event "Edit parameter reporting", then add "item_name" and save. (it looks you haven't done this)
After a while, let it log from users event. You will see the events logged with parameter "ITEM_NAME" as the attached screenshot
To Log event in firebase use the code below:
private FirebaseAnalytics mFirebaseAnalytics;
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, getString(R.string.title_activity_quotes));
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "ShareButton");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Add item_name in event page of firebase
Then You can debug from android studio or wait sometime to occur the event, then check in the select_content event in firebase
firebase select-content streamview
I am implementing Firebase Analytics in my app.
Everything works fine, I am getting the logged events in my Firebase console, but I am having trouble with the bundle data (Params) that are passed during the logging of event.
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.VALUE, "event Value");
firebaseAnalytics.logEvent(FirebaseAnalyticsConstants.ON_VIEW_EVENT, bundle);
I want to differentiate based on the VALUE param.
The VALUE parameter is meant to be numeric. See the documentation on it here.
Of course, you can log any custom parameter you want with your event, but parameter reporting is only currently offered on a subset of suggested events. Alternatively, you can query your raw events, parameters and user properties if you link your app to BigQuery.
I faced same issue:
//pass this code in any click event or anywhere.
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putString("Category",category);
bundle.putString("Screen",Screen);
firebaseAnalytics.logEvent("MyCustomEvent",bundle);
Pass this command for track:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
not when your app is send event log you will see logs. Custom tag i used android studio's emulator. Geny motion set SDK path from Genymotion: settings-> ADB.
Note: After 15-20 minutes open firebase console, see right side and select today. you will find your custome event.
Try this snippet code
findViewById(R.id.tvOrderTitle).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String strClickLogs;
Bundle params = new Bundle();
params.putString("mobileno", logMobileno);
params.putString("name", logName);
params.putString("email", logEmail);
strClickLogs = "Eventlogs_Generated";
Log.e(TAG, strClickLogs);
//Logs an app event.
mFirebaseAnalytics.logEvent(strClickLogs, params);
}
});
You can see genrated logs in verbose in Logcat as below format:
V/FA-SVC: Logging event: origin=app,name=Eventlogs_Generated,params=Bundle[{mobileno=9876543210, firebase_event_origin(_o)=app, firebase_screen_class(_sc)=SupplierListActivity, firebase_screen_id(_si)=7001228486350086694, name=Ashish Tikarye, email=ashisht#set.com}]
I am trying to integrate Firebase RemoteConfig and Analytics with my Android application. Remote configuration part is working but Analytics part is not working. Here is my build.gradle
// Firebase configuration
compile group:'com.google.firebase', name:'firebase-core', version: '9.4.0'
compile group:'com.google.firebase', name:'firebase-config', version: '9.4.0'
// Firebase analytics
compile 'com.google.android.gms:play-services-analytics:9.4.0'
Here is my Activity code.
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
firebaseAnalytics.setUserId("5107611364");
firebaseAnalytics.setUserProperty("custom_user_property", "custom_user_proerty_value");
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "SomeID");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "SomeIDName");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "IdType");
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
I am trying to publish customer property as well as the event but both of them are not working. I have enabled adb logging and I can see that custom event and property are published. These do not appear on the Firebase Analytics console even after 24hrs. I don't know what is wrong.
#Rakesh - you are looking in the wrong location. You are supplying customID feilds, in your example you are supplying CONTENT_TYPE : IdType. You don't need a minimum of 10 users to see the data...if you only have 1 user that data will appear within 24 hours of that user using your app.
I will say this, initially finding your own custom IDs is not very straight forward...it took me a while to find it too.
The place to find that custom reported info is: Anaylytics - Events - once on this page, click on the actual CONTENT_TYPE you are wishing to track, in your example above, it would be idType
Then on the Content graph you will see your customIDs (ie: someID)...click on someID. In my case (and in my screenshots) my equivelant someIDs are "field, button & select"
and then you will see all the data related to the values (someIDName) you passed into someID.
Now, if idType is not appearing for you then that may because Firebase isn't allowing you to create your own CONTENT_TYPE, I am not certain if you can do that as I have not tried...and in that case you would need to use a predefined CONTENT_TYPE. I am not using a custom idType, I am using CONTENT_TYPE : select_content.