简体   繁体   中英

Google Analytics Only track 1 screen, Android

I am trying to track the users that login into my app, but for no reason it only tracks the first screen.

Sometimes it track it with my package (com.company...), another times with the name Home Screen, and other times with "menu" (This one is what I put it)

I call this meted always I need to call a new screen.

public static void GATrackWithScreenName (String screen) {
      Log.d(TAG, "Tracking "+screen);

      Tracker tracker = GoogleAnalytics.getInstance(act).getTracker("UA-xxxxx-y");

      HashMap<String, String> hitParameters = new HashMap<String, String>();
      hitParameters.put(Fields.HIT_TYPE, "appview");
      hitParameters.put(Fields.SCREEN_NAME, screen);

      tracker.send(hitParameters);
  }

Edit: I also test this code, and some time works also with Map but no with Levels :S

Tracker easyTracker = EasyTracker.getInstance(act);

    // This screen name value will remain set on the tracker and sent with
    // hits until it is set to a new value or to null.
    easyTracker.set(Fields.SCREEN_NAME, screen);

    easyTracker.send(MapBuilder
        .createAppView()
        .build()
    );

Also I need to wait like 30 secs in the screen to appear the connection, I got this app on iOS and it's instantly

Any ideas?

Try adding <integer name="ga_dispatchPeriod">10</integer> in your analytics.xml.

It worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM