When my apps starts, asks a question to the user. I save the event like this:
Bundle bundle0 = new Bundle();
bundle0.putString(FirebaseAnalytics.Param.VALUE, "usertype1");
mFirebaseAnalytics.logEvent("my_user_type", bundle0);
This value can be usertype1 or usertype2
When im in the Firebase Dashboard i cant find the anwsers anywhere, in fact, the event tab shows this:
tipo_usuario == my_user_type
Valor = value
As u can see, it shows "value 0"
But, when im using the DebugView, i can see the usertype1 or 2 reaching firebase.
What im missing?
Value displays the accumulated value of all "tipo_usario" events but in order for the value to accumulate you cannot use putString(), instead use putLong() or putDouble(). https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param#VALUE
From what I gather you are looking to differentiate between two different types of users, so you should probably look into user properties instead. https://firebase.google.com/docs/analytics/android/properties
Related
I have integrated Firebase Analytics in my project. I am logging around 10 different events. I can see all these events on the dashboard.
The issue is I am unable to see parameter values of the event.
Ex.
Bundle bundle = new Bundle();
bundle.putString(AppConstants.PARAM_USER_ID, getUserId());
bundle.putString(AppConstants.PARAM_OFFER_ID, itemDetails.getId());
bundle.putString(AppConstants.PARAM_OFFER_TITLE, itemDetails.getTitle());
FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(activity);
mFirebaseAnalytics.logEvent("View_Item", bundle);
As per the above code, I can see the event named "View_Item" on the dashboard. But I can't see the details insight of each event's parameters like userId, item_id and offer title, etc.
Is there any way to see parameter values that?
Que 2. How long text parameter value can support?
Because I tried to log the event in Fabric with over 3k char. In this case, the content was getting cut and there no way to expand the full content in Fabric.
Is this same issue with Firebase?
I'm working with an Android App that functions as an instant messaging service, and I'm at the point of pulling the message data through into a RecyclerView. I have my Firebase Query object returning all the messages that match the id of the chat that has been loaded, this is done like so:
Query qChatMessages = mDbRefMessages
.orderByChild("messageChat")
.equalTo(mChatId);
So far so good, and this is returning the collection of messages that I expect. The problem is now that, upon passing them to the RecyclerView to be displayed, they come out in the inverse order of how you would typically expect an instant messenger to display, so the messages are actually getting older as you scroll down the chat.
My message nodes in the database all have a messageTimestamp field associated with them, so this is what I would want to sort the data by. The problem is that I don't seem to be able to find a way of ordering the data by any field other than the one that I'm querying on, or getting the results back from Firebase and subsequently ordering them.
Does anyone know how I can work around this, or if there's some Firebase capabilities I'm not aware of?
Thanks in advance,
Mark
The easiest way is to store an extra piece of data in your message nodes which is the epoch time multiplied by -1: this way you can sort on this field and the query will return the right order.
See this post on how to get the epoch time: how to get the number of seconds passed since 1970 for a date value?
However, note that with your current data structure, you will encounter a problem: you will need to sort on this new data (e.g. with .orderByChild("messageCreationTime")) AND filter for a given mChatId (e.g. with equalTo(mChatId)), which is not possible.
So, you would have to re-structure your database (if this is possible) like this:
- messages
- mChatId
- messageUniqueID <- most probably auto-generated by Firebase
- messageTitle: ....
- messageCreationTime: -1525857044
And you would query by:
Query qChatMessages = databaseReference.child("messages").child(mChatId)
.orderByChild("messageCreationTime");
i've logged a firebase event using the code below in android (a long time ago).
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.VALUE, String.valueOf(subjectvalue));
params.putString(FirebaseAnalytics.Param.CURRENCY, "IRR");
mFirebaseAnalytics.logEvent("Calculate_Cost_of_Hearing", params);
as you can see in this image the events are being logged and sent to firebase and shown separately but the value indicator still shows zero.
should i change my code in order to make it show the values or should i play with the options ? and my ultimate goal is to know the average values not just the SUM.
I am pretty sure that Value displays 0 because the parameter is bundled as a String. If you use params.putDouble() or putLong() instead of putString() the value should accumulate in the Firebase console.
You will not be able to display the average value per user in the event view since it shows only the accumulated value. If you want to work with the data you will have to connect your Firebase instance to BigQuery, pretty much.
Perhaps you could get the Value included in the "revenue per user" - metric on the Dashboard if you make the event count as revenue, but I have no experience doing that.
I report a Search event and add the search query to the bundle.
In Firebase, only the event is shown. I can see the stat on the search event log, but I can't see the value of the Term that were searched. From what I understand, the Term param is supported by Firebase.
Here is my code:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.SEARCH_TERM, query);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SEARCH, bundle);
What should I do to get the search term to appear in `Firebase?
You can use custom definitions to solve this problem.
Here's how
Go to firebase console
Then select the custom definition from the left panel
click on "create custom dimension" at the top right
Then enter the details as shown in this photo
After entering detail give it some time and then make a search event from your app.
now go to the events tab -> select search event -> and you will see your search term with the count in a separate card.
More info about the custom dimensions
From what I can understand from your code in the question, the code does not have any errors.
If you are implementing firebase analytics for the first time, it will take 24 hours for the events to appear in the dashboard.
After first event reported, next events takes around 3-4 hours to update in google dashboard.
Hope this info helps :)
I want to log user search event to Firebase but the Search_Term param value in the Search event doesn't show up in the dashboard. Here my code:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.SEARCH_TERM, searchText);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SEARCH, bundle);
I have tried to log different event with other param and the param value show up in dashboard correctly!
How can I fix this? Thank you
Currently the search data doesn't appear in the Firebase Analytics dashboard.
Your logging seems indeed correct. To see the data you can use Google BigQuery.
One thing you should do is to ensure that searchText is 36 characters or less, otherwise data will just appear as empty in Firebase (and BigQuery).
In general when struggling with data not appearing one should ensure that the logged events follows the possible combinations of events/parameters as described in https://support.google.com/firebase/answer/6317498 . Also notice that the Firebase Console doesn't show the data instantly after being logged (give it at least 30 minutes).
Update:
Firebase Analytics have later increased the maximum length of event names and parameter name to 40 characters, and the maximum length of string parameter values to 100 characters: https://firebase.google.com/support/release-notes/android#wzxhzdk4version_100_-_november_21_2016wzxhzdk5