Logging Custom Events in Firebase Analytics Android not showing custom events - android

I want to log custom events in the firebase analytics and I am using the standard way of doing it like below:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, eventCategory);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,eventType);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, eventName);
FcmAnalytics.getInstance(context).logEvent(eventType, bundle);
Although I referred documentation and multiple questions and even the firebase analytics documentation I am finding it difficult to understand with the way things are working here. I think most of them would have this issue as there is no clear documentation for this topic
Firstly can someone explain to me the meanings of the ITEM_CATEGORY, ITEM_NAME, ITEM_ID while logging the event and how are these reflected on the console.
Suppose I want to log an custom event on click of a button with a custom event name say "button_click_event" and want to see the same event on the console to see how many users have clicked the button, how do i do it?
I have used some predefined EVENTS like SELECT_CONTENT and VIEW_ITEM so how do I know which button was selected or which page was viewed, as only the event category names like "select_content"/"view_item" are shown in the console. How do I do it? Please help?

When logging an event, you can really use any param for any purpose, or make up your own params for your own use. You need to use params consistently so that they always mean the same thing in your app or you won't get useful information from them.
The ITEM_CATEGORY, ITEM_NAME, and ITEM_ID are described here. They are intended to be used with the VIEW_ITEM event.
To log a "button_click_event" from your app, you will need to create a FirebaseAnalytics instance within your activity, and call logEvent("button_click_event", new Bundle()) on it. Or you can add a param to the Bundle, such as the name of the button. Custom params won't show up in your reports but you can get a count of the number of times the event was logged in the dashboard.
You could try using the SELECT_CONTENT predefined event in place of a button_pressed_event, and a predefined param such as CONTENT_TYPE or ITEM_ID for the name of the button. Then I believe you would see the param information in the dashboard. You might need to wait 24 hours for the new data to show up.

Related

Contents of Bundle in Firebase Analytics Event not showing in dashboard

I have the same issue as this thread but the answer is outdated and seems to be incorrect. It refers to a button "Add event parameters" which is not present in the current version of firebase.
I want to view the content of the bundle for the event on my Firebase event page. Here is my event page on firebase:
I've followed this firebase tutorial and here is my code:
private fun sendLogging(context: Context, source: String, logMessage: String) {
val bundle = Bundle()
bundle.putString("LOG_MESSAGE", "$source $logMessage")
FirebaseAnalytics.getInstance(context).logEvent("PUSH_CONTENT_NOT_RECEIVED", bundle)
}
The source and logMessage contain precise information about what went wrong and I need to view this. It should show up?
EDIT:
I went to "Custom Definitions":
And I've added the event:
I discovered that only from that moment it started collecting information. But I do not see the information that I've logged anywhere. Where is it?
Adding LOG_MESSAGE to the Custom Definitions as an event-scoped custom dimension is the correct direction. You can follow the "Create a custom dimension" on the "[GA4] Custom dimensions and metrics" page.
GA4 limits the length of event parameter names & event parameter values. See [GA4] Collection and configuration limits for more information. In your case, LOG_MESSAGE is the event parameter's name (limited to 40 characters), and the runtime value of "$source $logMessage" is the event parameter's value (limited to 100 characters).
If "$source $logMessage" needs to be more than 100 characters, you could make the source and logMessage separate event parameters. For example, you'd update your code to:
bundle.putString("LOG_MESSAGE_SOURCE", source)
bundle.putString("LOG_MESSAGE_VALUE", logMessage)
Then, you would register LOG_MESSAGE_SOURCE and LOG_MESSAGE_VALUE as two event-scoped custom dimensions, and each would be limited to 100 characters individually.
Thanks,
Brett Sneed
The Google Analytics Team
Try adding the LOG_MESSAGE under Custom Definitions as an event or user custom dimension, this now available from the menu on the left in the Analytics section.
Custom Definitions Image

Firebase Analytics Event properties are not shown, but do appear in DebugView

I have added Firebase Analytics events to my android app, and when I tested it with DebugView, I could clearly see the events and all their properties.
However, after launching the app, I can only see the events themselves, and the properties are missing.
I'm using :
val props = mutableMapOf<String, Any>()
props["test key"] = "test value"
Firebase.analytics.logEvent("action_test", props.toBundle())
As stated above, it works perfectly fine when I test it using the DebugView in Firebase console.
But when I go to Events sections, and click on some event, and then go to add filter, I cannot see the event properties.
The only thing I see is in that page, some statistics like the total number of events, etc.
In Firebase under "Analytics" click on "Events". Then click on the specific event you want to see the parameters of.
In your example the event name is "action_test", the parameter name is "test_key", the parameter values are the values of the map.
Now click on "action_test" in Events. It will open a detailed view for the event. Some cards will have as the title the name of the parameter.
It will take some time before the events are shown. Can be up to a couple of hours.

How to migrate from GA v4 to GTM v5 (mobile)?

I found how use GTMv4 for GA and GTMv5 for FA, but no any information for v5+GA (for web side little bit more information).
is the correct replacement(in each case)?
Case 1:
Bundle params = new Bundle();
params.putString("screenName", screenName);
params.putString("screenID", screenID);
df.logEvent("openScreen", params);
from
getDefaultTracker().setScreenName(screenName);
getDefaultTracker().send(new HitBuilders.ScreenViewBuilder()
.setCustomDimension(3, screenID);
Case 2:
Bundle params = new Bundle();
params.putString("category", getCategory());
params.putString("action", getAction());
params.putString("label", getLable());
params.putInt("value", 0);
params.putString("name", "start");
df.logEvent("event", params);
from
getDefaultTracker().send(new HitBuilders.EventBuilder()
.setCategory(getCategory())
.setAction(getAction())
.setLabel(getLable()))
.setValue(0)
.setCustomDimension(2, "Start")
.build());
So, how need configure tag? In manual for v4->ga we have Variable type "Data Layer Variable".What is analog for GTMv5?
Also, where I could get all key for bind data?
img from manual v4, but i can't find similar information in v5
From manual:
Event Name: The value is set to "eventNameXYZ" when the following code in your app is executed:
Android:
FirebaseAnalytics.getInstance(mContext).logEvent("eventNameXYZ", null);
but how to set value? I can create only "new variable" with "Title". Or need set name equal key, e.g. "eventNameXYZ"?
Secondary Question:
It possible to use GTM+Firebase for save data in local storage?
Update
aghhhr, why divided radio buttons? + Custom parameter looks like hint :(
If you're trying to send Universal Analytics hits from firebase, then case 1 and case 2 both look correct, though you might want to be more specific about the name of the event in case 2. If the event you're recording is equivalent to one of the suggested Firebase Analytics events, then consider using that as the event name, instead of the more generic name event.
To setup a GA tag to fire for these logEvent calls, you'll want to create "Event Parameter" variables for each of the event parameters you're using. For example, to capture the screen name you're including in case 1, you would setup an EventParameter like this:
For the tag setup, you just use the screenName variables as the values in fields to set, event variables, or custom dimensions. For screen views, be sure to provide a screen name, as it's required for a screen view.
To trigger the Universal Analytics tag, you would setup a trigger for event name. In the first case, the trigger setup would look like this:
.
And to answer your second question, You can use Firebase user properties to store data in local storage, report it to firebase, and make it available to GTM via the Firebase User Property variable type.

Where do I view event parameters with Facebook Analytics App Events?

I'm using Facebook analytics in my Android app to log app events - I'm seeing the correct tracking of app events and am able to view them in my Facebook App Analytics dashboard.
However, I have no idea where parameters that I attach to each event are displayed. Some of them are automatically summed and shown - for instance, purchases or other values. For other, string-based parameters, however, I'm unable to figure out where I can view them.
As an example:
Say every time something goes wrong in my app, I log an event named "Error". I then pass the parameter named AppEventsConstants.EVENT_PARAM_DESCRIPTION a string description - so this might be "App Crashed" or "No Internet Connection" or something. Let's say one of each happens.
When I go to view my analytics, I will correctly see that there have been two "Error" events. But now I want to know whether these were instances of "App Crashed" or "No Internet Connection" - presumably that's what the point of the parameters is. How do I do this? I've googled and clicked everything I can think of, but haven't found a way to see the parameter breakdown of an event.
I can confirm that it is troublesome to find and the name has been changed to "Breakdowns"...
Activity -> Breakdowns
click "Create New" in upper right
give the report a NAME
select the top level event from the EVENT pop-up
select one or more parameters to report on from the 3 BREAKDOWN
pop-ups (note that your custom parameters appear at the bottom of
these menus)
Yep, its not simple to find that information. You will need to use Segments in Facebook Analytics for that. Go to Segments and try creating a new segment. Define Condition Type as "Events". Then select the Event then you want to include. After that, select the option of "Refine". This will show you "Select a Parameter". Here you can select the parameter that you want to see and its value. Save this segment, and use it in any chart you want.
Unfortunately, that is the best way I have found, though it is not as straightforward as it should be.
I tried using the ways based on the answers provided here. But the fact is, it is tedious or going round the bush.
The answer is simple, just send the values and parameters wrapped inside "contents".
It will be visible on your analytics dashboard the same as standard events do.
var name = "Dhinesh";
var platformName = "flutter";
//custom event - fb analytics
fbq('trackCustom', 'FreeTrialPlatform',
// begin parameter object data
{
contents: [{
name: name,
platform: platformName
}],
content_type: 'product'
}
// end parameter object data
);
View in fb analytics
For your case like this,
var errorName = "App crashed";
fbq('trackCustom', 'TrackError', {
contents: [{
Error: errorName
}],
});

Android notification dismissed callback?

my app searches for new articles and sends a notification like "5 new articles". However when i send another one, i want to have it update the text to lets say there were 3 new so something like "8 new articles" BUT "3 new articles" if the user has dismissed that previous notification. I hope you get it.
Is there a way to know that notification was dismissed so i can reset the count?
Thanks !
This is a rather belated answer but I was looking to find out how to do this myself so perhaps it'll be useful to others. In API level 18 the following service was introduced which should make this straightfoward as you can now get a callback whenever a notification is added or removed:
https://developer.android.com/reference/android/service/notification/NotificationListenerService.html
In particular for the original question see the onNotificationRemoved method
The other option mentioned by jpop above is to use the builder's setDeleteIntent method when creating the notification, which will give a callback when the notification is deleted. This would then require you to maintain the state of the existing raised notifications somewhere else as it only tells you when something is added, not removed.
If your app has a database you can do this: Create a table that has some fields like id as int, article name as string, and isdismissed as boolean. So, each time you want to send a notification, you should count the records that the isdismissed field equals false.
In the other hand, each time user select a notification, the related isdismissed field must be equal true.
In addition, this sample from developer.android.com maybe can help you:
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
the listener don't work since android Nougat, a new access rule have been added
on android device : parameters -> applications -> gear menu -> spécial access -> notifications access
use : catch on swipe to dismiss event

Categories

Resources