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.
Related
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
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.
I want to set user level custom variables using google analytics in android
I can see there is lack of documentation and demo for this I want to know how to set custom variable using GA and I am referring to following link
https://support.google.com/analytics/answer/2709828#scope
but it is not helpfull at all code given in it is not in java and very confusing
If anyone has proper sample related to it please share
And it is not clear at all how much time it will take to reflect these changes on GA dashboard there is no clarity while using google analytics.
Also there a sample a code given
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);
t.setScreenName("Home Screen");
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once.
t.send(new HitBuilders.ScreenViewBuilder()
.setCustomDimension(1, "premiumUser")
.build()
);
Now can anyone explain what is value 1 stands and it comes from where for in above call and why I need to call setScreenName
Also I have referred below link as well but does not give any clear idea
https://support.google.com/analytics/answer/2709829?hl=en&ref_topic=2709827
Also I tried to create custom variable I observed that one custom variable Demographic is already there I guess it is default created by GA so now my custom variable will start with index 2 or 1 that is also a confusion.
Custom Dimensions and metrics are identified by an index: 1 to n. The first Custom dimension you create will have an index of 1. Before you can send custom dimension and metric values to Analytics, they must first be defined in an Analytics property in the Analytics UI or through the Management API. Each Analytics property has 20 available indices for custom dimensions, and another 20 indices available for custom metrics.
The sample you used is sending a screen view hit (hence why it is setting the screen name) and sending a value to the first custom dimension. However you can send the information on any event type you'd like. For example:
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);
// Build and send an Event.
t.send(new HitBuilders.EventBuilder()
.setCategory(getString(categoryId))
.setAction(getString(actionId))
.setLabel(getString(labelId))
.setCustomDimension(1, "premiumUser") // Set the first custom dimension value to premiumUser for this event.
.build());
When you query for the value of the custom dimension with the Analytics Reporting API you will identify the custom dimension by index aswell, ga:dimension1.
Apart from registering in Android
Bundle().apply {
putString("Business", "NONE")
putString("PageVertical", "NONE")
FirebaseAnalytics.getInstance(context).setDefaultEventParameters(this)
}
Do not forget to register at Google Analytics UI
Custom parameters: Custom parameters can be used as dimensions or metrics in Analytics reports. You can use custom dimensions for non-numerical event parameter data and custom metrics for any parameter data better represented numerically. Once you've logged a custom parameter using the SDK, register the dimension or metric to ensure those custom parameters appear in Analytics reports. Do this via: Analytics > Events > Manage Custom Definitions > Create Custom Dimensions
Read more
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
}],
});
Following this guide I've added GA to my app and it works just fine. To send hits, I use the following code:
getGaTracker().set(Fields.SCREEN_NAME, "Screen Name");
getGaTracker().send(MapBuilder.createAppView().build());
But what if I want to set more parameters to this Tracker? If you check Fields.class, you will se lots of parameters that can be set.. like in hitParameters.put(Fields.HIT_TYPE, "appview");, can I set any arbitrary value for HIT_TYPE? Where will this appear in my stats, and what are the other fields for?
I also want to find out if I can add more parameters to 'getGaTracker().set()', in a way to add more logging levels like when logging Events...
Again from the DevGuide we have this snippet:
Tracker t1 = GoogleAnalytics.getInstance(this).getTracker("UA-XXXX-1");
// Trackers may be named. By default, name is set to the property ID.
Tracker t2 = GoogleAnalytics.getInstance(this).getTracker("altTracker", "UA-XXXX-2";)
So the Property ID isn't the only possible parameter for instantiating a Tracker. It would be great to have some docs do check all uses for it.
The only thing I found so far is this page