Search code examples
androidfirebasefirebase-analyticstarget-audience

How to define an Audience with Firebase Analytics?


I want to keep track of my app's Audience by separating them with a custom attribute. Every user have a list of permissions. I want to be able to separate them with this attribute when then login into my app.

Currently, all the user falls into the category "Alls Users" instead of their separate categories... I log in using CEO more than 10 times and I waited few days... Still, I only see the audience name 'All Users' increments instead of my custom 'CEO' audience.

Here's how I setup the attribute:

Note: In my example here, let's say the user role returned by getRole() is 'CEO'

In my LoginActivity.java

    for (EntityRole mRole : new ArrayList<>(profile.getRoles())) {
        mRole.setUser(profile);
        GenericDAO.getInstance(EntityRole.class).addOrUpdate(mRole);
        Bundle bundle = new Bundle();
        bundle.putString(FirebaseAnalytics.Param.SIGN_UP_METHOD, mRole.getRole());
        mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, bundle);
    }

Here is my setting in Firebase:

Firebase

Here is the result:

enter image description here


Solution

  • I receive this from Firebase Support:

    Hi,

    Thanks for reaching out to the Firebase Support. Sorry we couldn't get back to you anytime sooner as we are experiencing a high inflow.

    I can see your question on Stack overflow and conversion with a engineer. In order to proceed further with the investigation, I would like to know if you tried logging the events using the debug mode?

    Use verbose debug output to confirm successful event logging or identify problems with setup. To enable verbose logging on each platform, follow these steps :

    Android adb shell setprop log.tag.FA VERBOSE adb shell setprop log.tag.FA-SVC VERBOSE adb logcat -v time -s FA FA-SVC

    iOS Pass this argument on launch in Xcode : -FIRAnalyticsDebugEnabled

    In addition to this can you check to see if you have applied any filter applied from previous report. This can often cause a report to show no data if it doesn't have any users that meets the criteria. Make sure to clear any filters if you want to step back to a high-level overview.

    Regards, Animish