How can I set up FB Analytics in a way that it calculates the average value of a specific custom event? I'm using it on Android. This is the code of the custom event log:
public void logLevel(int level){
Bundle params = new Bundle();
params.putInt("user_level", level);
mFirebaseAnalytics.logEvent("user_level", params);
}
If the app sends level 10 from one device and level 20 from another one I want firebase to display avg level 15. Is that possible?
I think that way you're logging the event and its parameter is correct. Once your event is visible in the Event page of Firebase console, add the parameter in reporting. Make sure to select the right data type, which is Number for your case.
Keep logging the data and you should be able to see similar to this:
This is the score parameter of post_score event in the Firebase demo project. Check it out.
Related
In one of my iOS app I am using a cloud function that is continuously observing Firebase Events(like first_open, etc.) and we are able to observe predefined firebase events like (first_open). But when we create our own custom event(like "new_event") then observe not working.
A function that I am using for observing events :
exports.Test_Second_Function = functions.analytics.event('testFunction').onLog((event) => {
});
I am able to call the events from the Firebase audience with the trigger. But can we observe these events through cloud functions?
Because when I am sending this event from mobile devices then we can observe.
Thank you.
The solution which worked for me is that -
Hit a simple event(from mobile) that we want to trigger when new entries come into the audience or when the audience refreshes.
e.g. Analytics.log("sample_event", parameters: [:])
This event we can check in debug view and real-time inside the Firebase Analytics section.
After some time entry of this event will come in event sections of the Firebase(In my case this took around 12 hours).
After that we just need to check "mark as conversion" from the events section(this again takes some time to reflect, In my case, this took around 8 hours).
Now when any user comes into our audience then this event will trigger and we can check the count also for the event(for cross check that event is called or not).
Thank you.
In my A/B testing (with Remote Configs), I want to know which variant performed better based on daily user engagement.
As I can not see the built-in goal metric "Daily user engagement" in the dashboard, so I want to create my custom.
Could I track an event with parameter VALUE and set it as a goal metric (based on its value) in A/B testing?
This is how want to do:
// Firebase Unity SDK
FirebaseAnalytics.LogEvent("time_spent", FirebaseAnalytics.ParameterValue, time_spent_in_seconds);
Thank you.
Declare an event in the class where you want the vent to be fired. I dont know the type of FirebaseAnalytics.ParameterValue as I am not familiar with firebase nor with your app. I will assume its a string:
public event EventHandler<string> raiseFirebaseEvent;
Wherever in your code (normally a different class where the event is declared, and after invoked which is the same) you need to add a listener to this event, this means to add a method to the event, to be called after in the event trigger.
In this other class you will have a method that will be the one to subscribe to the event:
prevate void FireBaseLogger(FirebaseAnalytics.ParameterValue value) {
FirebaseAnalytics.LogEvent("time_spent", value,
time_spent_in_seconds);
}
time_spent_in_seconds shoul be a variable of this other class I guess.
Somewhere in this class, usually in the constructor, or somewhere you know for sure that the code ejecution will go through there, you should subscribe to the event. For this you need a reference of your event holder class, where the event was declared:
EventHolderClassInstance.raiseFirebaseEvent += FireBaseLogger;
No arguments are passed in the subscription, just the method.
Then, in your EventHolderClass, when you invoke the event, passing the string parameter, the subscribed method will be called as long as the subscription was done prior the invocation.
raiseFirebaseEvent?.Invoke(this, FirebaseAnalytics.ParameterValue);
When there are no methods subscribed raiseFirebaseEvent is null, that is what the question mark is for. If there was no previous subscription raiseFirebaseEvent is null, and nothing happens.
In case FirebaseAnalytics.ParameterValueis not string type, change the type accordingly in the event and in the private method subscribed in the class where the listener is added, or where the subscription is made that means the same.
Not sure if that is what you were asking.
It seems that currently, in-app messages triggered by events only respond to the occurrence or not of the event. One of the richest event in an app is screen_view, which would only be helpful when using the values stored as parameters of the event.
Is there any workaround to do it?
What I'd like to achieve is this:
A user opens any screen in the app, triggering the screen_view event, with the firebase_screen_class parameter specified (this is triggered automatically by the iOS api as far as I'm concerned).
An In-App Message is triggered when that specific event is triggered with an specific value in a parameter.
I explored two options:
Firebase in-App Message is set to appear when an event with an specific parameter value occurs.
Event is captured using Firebase Cloud Functions, triggering the In-App message when the parameter condition is met directly from the function.
Unfortunately I haven't find anything in the documentation, nor in Google or Github that makes me thing this is possible yet.
I was looking for the same thing and reached out to Firebase support. Here's what they told me
Currently, it is not possible to use a specific event (e.g
screen_view) with a specified parameter (e.g firebase_screen) as an
event trigger for Firebase In-App Messaging. As a workaround, to use
the specific parameter for FIAM targeting, you may define it as an
audience first to be able to target it on the composer.
I did not adopt their workaround, but I tried doing the below and it worked for me:
Create an extra Firebase event tag via GTM, set action as "Add Event", and define an event name for it e.g. "screen_a". This is triggered upon your desired combination of event_name and firebase_screen_class value
In Firebase Console, set the FIAM to be triggered by the event name you have defined in step 1 (i.e. screen_a)
I have kind of a tricky question without an answer (I went through the documentation but did not find what I was looking for) :
I am tracking two specific events in my app, one is the start of a GPS tracking, the other one is the stop event. In Firebase Analytics, I am able to select those events in order to create an audience.
The audience I want is when an user triggers the start event of the GPS tracking process, but does not go through the whole process and does not trigger the stopevent.
So basically when I create the audience I have to select both startand stop event, but the thing is I actually have no value assigned to those events. For the moment, as a test case I told the audience to track if start > 0 and stop <= 0.
I suppose it is not going to work as expected. How should I track the event in the Android app, and how should I retrieve it in the audience creation ? By default, is my start event value is the number of times the event triggered ?
Thanks in advance,
Your question does not mention which SDK you are using (Android, iOS, etc. please make your question more precise) - I will assume it's Android.
When logging an event, you can set parameters. A parameter is made of a key and a value. If you want a value assigned to your event, you must use a predefined key : FirebaseAnalytics.Param.VALUE. In this case, the value is accumulated automatically for each event type.
The following snippet will do the work for your start event, stop will work the same way of course :
private void logStartEvent() {
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.VALUE, 1);
firebaseAnalytics.logEvent("start", bundle);
}
Then you should be able to create an audience with start > 0 and stop <= 0
Hope this helps.
Im using google analytics in my ios program to gets user Events.
this my code for capturing user interaction in my View :
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:#"&uid"
value:uniqueIdentifier];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:#"CategoryVisit"
action:#"CategoryName"
label:self.catname
value:self.code] build]];
}
now how can i filter in admin panel base on event value ??
there is only filter base on "Action,Category,Label".
also is there possible way to filter base on uid ???
First of all, event value is a metric, so you won't see it under the dimension tab. Second of all, &uid is a user ID and should have an associated custom dimension. It could be sent with the event hit which you would be able to show in the custom report.
The event value is a metric so you won't view it in the dimensions tab.
Filter based on uid? The User ID? Nope that is not possible. However, you can do the following hack:
You create a custom dimension and set the uid there.
In your custom report you can then filter events based on that custom dimension.