[JAVA] How should I set Firebase Analytics events and parameters?

〇Overview

Firebase Analytics is a function that easily acquires and aggregates events such as the number of times users use it, level up, and setting changes. However, even if I looked at the official explanation and created it, the result was different from what I expected, so I tried to summarize for beginners how to configure the event and parameters. The implementation method is rough. After that, the sample data is only for one day ...

〇 Implementation method

The official implementation method is described here. https://firebase.google.com/docs/analytics/android/start?hl=ja Android Studio Tools → Firebase → Analytics You can easily do it just by following the instructions from.

〇 Data transmission example

You can easily send it by inserting the following source.


private FirebaseAnalytics mFirebaseAnalytics;
・
・
Bundle bundle = new Bundle();
//Set String type parameter
bundle.putString("key", "value");
//Set Int type parameter
bundle.putInt("key", value);
//Set event
mFirebaseAnalytics.logEvent("original_event", bundle);

All you have to do is send the event and its associated parameters. The number of parameters can be arbitrary. The number of events, the location where the event occurred, the gender, and the age can be obtained automatically without setting any parameters. Please note that there may be a few hours of error before it is reflected in the Firebase console.

〇About each value

・ Event

A unit of user-operated events. If you look at Events in the Firebase console, you should already have some by default. [List of automatic collection events] https://support.google.com/firebase/answer/6317485 We will create an original event here. Since it can be set up to 500, I would like to divide it into small pieces.

By the way, it seems that once an event is created, it cannot be deleted from the console. If the data does not come, it will not be visible from the default view (because it is displayed for the past 28 days), but be careful because it is embarrassing to make it with a strange name. (Creation example) · [Add_payment] User paid ・ [Access_info] The user entered a specific screen ・ [Level_up] The user has leveled up

・ Parameters

You can set multiple parameter names and values for an event. (Creation example) [level_up] For level-up events -[job] Occupation of the character who leveled up -[level] Level of the character who leveled up Events are automatically added to Events in the Firebase console when you send data, whereas parameters are not reflected unless you click [...] next to each event and add them from the parameter report. You can select text and number as the type, but there is a limit of 10 text and 40 number. If you select a numerical value, you can also make detailed settings such as distance and time.

〇 Should the parameters be text or numerical?

What should be text is easy to understand. Take a game app as an example (Creation example) Event [create_user] Occurs when a user creates a new player --Parameter (text) -[Character] Occupation of newly created player

With this text setting, you can see the total number of players created and the breakdown of their profession. If you check the check box, you can check the graph display of only the target data and the daily value by mouse over. (Note) The daily values are displayed on the graph, and the total is not displayed on the graph. Image.png

Next, regarding the numbers, let's look at an example when the level is raised as an event and the level at that time is a number, so it is saved as a number. (Creation example) Event [level_up] Occurs when the user level up --Parameter (numerical value) -[Level] Increased level value Image.png

In terms of numbers, you can only see the total "average" (13) and "total" (62). The graph shows the daily "average" and "total", and you can see the daily values by mouse over. Even if you know the average value and total value of people who have leveled up, it is not good because you do not know the distribution.

After all, it seems that there are many cases where it is better to save as text as shown below. In this case, it is easy to understand that there are 5 players who have leveled up in total, 3 of which have reached 13th level (2 of them are the same user), and 1 of which is 10th level and 18th level.

Image.png

Then, when is it saved as a numerical value? If you think about it It is assumed that a wide range of numerical values such as the staying time of a specific page, the score of the game, and the moving distance of the car navigation application are aggregated. It's difficult to use because you only know the average and total, When connecting to a site with access restrictions such as 100,000 a day, you may be able to see the increase in the total value.

By the way, I tried distance, seconds, and passage, but the units just stick together. 11m, 3 minutes 20 seconds, $ 10.80, etc.

〇 Conversion settings

There is a "mark as conversion" on the console, but conversion is a measure of the performance of the app. If this increases, such as the number of launches and the number of charges, the app is successful. If checked, it will be displayed on the Dashboard.

〇 At the end

I wondered if this would happen, and when I set it up in the private app and S-in, I was in trouble because I couldn't get it as I expected and I couldn't erase it. : cold_sweat: Basically, I hope that fewer people will be addicted to the same problem. (And a memorandum)

Below is the official sample

・ Event: All apps https://support.google.com/firebase/answer/6317498 · Events: Retail and e-commerce https://support.google.com/firebase/answer/6317499 ・ Events: Jobs, Education, Regional Sale, Real Estate https://support.google.com/firebase/answer/6375140 ・ Event: Travel (hotel, airline ticket) https://support.google.com/firebase/answer/6317508 ・ Event: Game https://support.google.com/firebase/answer/6317494

Someday we will work with BigQuery ...

Recommended Posts

How should I set Firebase Analytics events and parameters?
How to set up and use kapt
I touched Scala ~ [Type parameters and displacement specification] ~
How to set up and operate jEnv (Mac)
After all, how should I use Rails callback?