I am trying to send screen-view hits to Google Analytics using Google Tag Manager, but in the real time view it is showing screenName value as (not set). Actual screenNames are also shown but along with them (not set) is also reported. Can someone please point out what I am missing.
The way I have set it up is to add a new tag to be able to track the screen-view separately:
----> Full config image example here <----
New tag in the GTM container with "Screen View" Track type
Add in "Fields to Set":
Field Name
screenName //Yes, exactly like that
Value
{{Item Name}} // Yes, exactly like that
Triggering: add a new trigger configuration with
Trigger Type
Custom
Trigger fires on
Some events
Event Name equals view_item
Then, on the Android tracking code:
Make sure you track it like this:
String yourScreenNameString = "Screen One"; //This is an example
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, yourScreenNameString);
_firebase.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle);
----> Example of how the GTM looks <----
I am a first timer at Firebase Analytics and I need some help with event logging.
I'd like to organize my user actions like "Screen X, event Y".
What I achieved so far is this:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, screenName);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, actionName);
firebase.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
and I invoke this method every time I want to log something.
In the Analytics console, this translates to a chart with all the screen names organized by Content_type, like this:
but when I click on one of the items (the tutorial screen "TUT" for example), nothing is organized by actionName. It's all bundled in (not_set) like this:
What am I doing wrong?
Is there a better way to handle this type of stuff?
Solved!
It seems like you need to set an ITEM_ID as well, in addition to CONTENT_TYPE and ITEM_NAME.
Hence I got it working by just adding theĀ ITEM_ID parameter like this:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, screenName);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, actionName);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, actionName);
firebase.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
I don't know if it is the right way to handle this kind of event logging but it works for now.
Better solutions are welcome!!
I've seen some questions and answers about custom events for firebase analytics, but i just wanted to ask you a straight question so you can give me a straight answer :)
So, this is my method for logging:
#Override
public void logFeatureSelectedEvent(String categoryName, String actionName, String labelName) {
Bundle bundle = new Bundle();
bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
bundle.putString(EventTrackingKeys.EventTypes.LABEL, labelName);
mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}
with custom event/key names:
String CATEGORY = "category";
String ACTION = "action";
String LABEL = "label";
String FEATURE_SELECTED_EVENT = "feature_selected_event";
So, in my firebase console I only get event name "feature_selected_event", without custom parameter names..
I've seen some answers that i should call setUserProperty() method and register that user property in the User Properties tab of Firebase Analytics.
Is this the right way to implement that method? :
#Override
public void logFeatureSelectedEvent(String categoryName, String actionName, long value) {
Bundle bundle = new Bundle();
bundle.putString(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
bundle.putString(EventTrackingKeys.EventTypes.ACTION, actionName);
bundle.putLong(EventTrackingKeys.EventTypes.VALUE, value);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.CATEGORY, categoryName);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.ACTION, actionName);
mFirebaseAnalytics.setUserProperty(EventTrackingKeys.EventTypes.VALUE, value);
mFirebaseAnalytics.logEvent(EventTrackingKeys.EventAnalyticTypes.FEATURE_SELECTED_EVENT, bundle);
}
You can see it in console without any hacks, but it is pretty hidden there.
Go to Firebase Analytics -> Stream View -> Select Events -> Top events -> select_content -> there you go
My code:
Bundle params = new Bundle();
params.putString("invalid_url", urlPart);
mFirebaseAnalytics.logEvent("eventInvalidUrl", params);
The custom parameters will not be shown. Only suggested events with suggested parameters are presented in dashboard.
To see the custom parameters, you have to link your project to Big Query (it's not free).
Also Firebase will not show information if the number of user is less than 10.
If you are still looking for answer,
You need to add custom parameters into the event manually once in the dashboard
Like this https://support.google.com/firebase/answer/7397304?hl=en&ref_topic=6317489
Actually there is no need to link BigQuery for this. But it will take several hours to show up custom parameter once you navigate inside the event.
In Firebase, As i know we have to log the events in < Key,value > pair and then need to log.
Like this :
bundle.putString("yourKey","yourValue");
For Example, I have put the Custom event in MyApp to get the AppOpen time as below.
Bundle params = new Bundle();
params.putString("open_time", TimeStampUtil.getTimeStamp(System.currentTimeMillis()));
mFirebaseAnalytics.logEvent("app_open_time", params);
so, in above example i have create a custom event with name app_open_time and put the value with key as open_time.
Try in this way and for more info refer this : https://firebase.google.com/docs/analytics/android/events
Not only do you need to do what Muhammad Riyaz says, you also need to get your user count up above the "threshold". In my case, installing my app on a dozen simulator versions pushed my user count to 12, and voila, suddenly I have custom event parameter data in my Firebase dashboard.
Similar to #Josef Vancura answer, but in Kotlin:
val params = Bundle()
params.putString("invalid_url", urlPart)
mFirebaseAnalytics.logEvent("eventInvalidUrl", params)
I am trying to pass my double array from one activity to the other. However I cannot figure out how to do this, as the methods I' ve tried just give me error messages.
This is what I' ve tried in my MainActivity:
intent.putExtra("nutritional_value", temp.nutritional_value);
(in case necessary: I have defined the variable 'temp' in a third java class like this):
SingleItem temp = list.get(position);
This is what I' ve tried to do in my second activity:
double[][] nutritional_value = intent.getDoubleArrayExtra("nutritional_value", 0);
I' m not exactly new to Android but I' m still in the learning curve, please tell me if you know how I can fix this, I would really appreciatie it.
Thanks
Try serialzing the array, something along the lines of
double[][] nutritional_value =....
Bundle bundle = new Bundle();
bundle.putSerializable("array_array", nutritional_value );
You can't like that. putExtra doesn't take multidimentsional . You'll need to either:
Wrap it in a Parcelable class you will have to write.
Serialize it in some other way. Gson to string for example. Gson will cope with multidimensional arrays.
getDoubleArrayExtra refers to a single dimensional array of double values.
My requirement is like, I have a webservice url where from I load the datas into tree view. u communicate webservice load all first leve menus. Later when I click on first menu, i again communicate webservice to get the second level node data, my webservice data has an attribute nodetype = "group" or "item" which means if it has sublevels It says group else "item". I can use this to show + or - mark in my treeview. I have gone through the treeview in google Code. They load all the data at once which does not suit my reuquirement. Please need some help on logic building. If any one has already done such thing it would be really great if you can share the code here or mail me at colddropz#gmail.com.. Thanks in advance!
You can study this library: https://github.com/bmelnychuk/AndroidTreeView to get your required tree-view. It's a N-level tree with supporting custom styled node. You can use it as following:
1) install: compile 'com.github.bmelnychuk:atv:1.2.+'
2) build tree-view:
TreeNode tree_root = TreeNode.root();
TreeNode parent = new TreeNode("node-name");
TreeNode child0 = new TreeNode("child-node-name-1");
TreeNode child1 = new TreeNode("child_node-name-2");
parent.addChildren(child0, child1);
tree_root.addChild(parent);
3) add tree-view to layout:
AndroidTreeView treeView = new AndroidTreeView(getActivity(), tree_root);
containerView.addView(treeView.getView());
You can customize the node-view to show + or - mark in your treeview with extending TreeNode.BaseNodeViewHolder