How to send a screenview event to help Firebase prediction make a more accurate forecast

I have one Activity, with several Fragmentin ViewPager.

This is currently my way to send a screenview event to both Google Analytics and Firebase


public static void trackView(Activity activity, String view) {
    trackFBView(activity, view);
    trackGAView(view);
}

private static void trackFBView(Activity activity, String view) {
    if (activity == null) {
        return;
    }

    FirebaseAnalytics firebaseAnalytics = getFirebaseAnalytics();
    if (firebaseAnalytics == null) {
        return;
    }

    firebaseAnalytics.setCurrentScreen(activity, view, null);
}

private static void trackGAView(String view) {
    Tracker tracker = Utils.getTracker();
    if (tracker == null) {
        return;
    }
    tracker.setScreenName(view);
    tracker.send(new HitBuilders.ScreenViewBuilder().build());
}

public static FirebaseAnalytics getFirebaseAnalytics() {
    if (false == isGooglePlayServicesAvailable()) {
        return null;
    }

    return FirebaseAnalytics.getInstance(JStockApplication.instance());
}

In my listener, ViewPagerthis is how I send the screen view event.

private ViewPager.OnPageChangeListener getOnPageChangeListener() {
    return new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {

            if (position == 0) {
                Utils.trackView(DetailedStockFragmentActivity.this, "InfoFragment");

After some testing, I understand that I am getting a screen event in GA , but not in Firebase.

Later I understand that it firebaseAnalytics.setCurrentScreenactually does not send a screen view event to Firebase. firebaseAnalytics.setCurrentScreenjust prepare the implicit parameter. It will only be sent to firebase during the next event.

Currently, in my snippets I did not fire any events explicitly.

, Firebase ( Firebase ), , "Screen View" ?

private static void trackFBView(Activity activity, String view) {
    if (activity == null) {
        return;
    }

    FirebaseAnalytics firebaseAnalytics = getFirebaseAnalytics();
    if (firebaseAnalytics == null) {
        return;
    }

    firebaseAnalytics.setCurrentScreen(activity, view, null);

    // Question: Should I do this to help Firebase makes better prediction?
    firebaseAnalytics.logEvent(view + "_ScreenView", null);
}
+4
1

, .

-, , setCurrentScreen , . , Firebase - . " " , , , . , .

- , Firebase Prediction. . , , , ().

, . , "". ( , , " , ".) , , , , select_stock, , , . A/B , .

, , . , , , , , .. , A/B, , , , : " X?"

TL; DR: , , : " , 7 ?" , , , , A/B-.

, , , .

, :

, , Firebase, , Googlers , . , , .

, , . ML , : (). Prediction , , Google , . AFAIK, ML , , , (Google, , , , dunno).

ML . , , , , , , . , "", " " " ". , , .

: ", !" , , . : ", , , , ". , : , , , - . : " , ", .

, , , , , . , , , , item_added_to_card. , .

, , , , , , , . , , , . , , , , , .

, , , , , . , , , , , , - ? , . : " , ". ML, , , , , , .

PS: , .

+4

Source: https://habr.com/ru/post/1691415/


All Articles