Google Analytics API v4 for Android Does NOT Send Screen Views

后端 未结 4 1882
独厮守ぢ
独厮守ぢ 2021-02-05 17:38

I\'ve set all things for google analytics api v4 as it mentioned here:
https://developers.google.com/analytics/devguides/collection/android/v4/
and here:

相关标签:
4条回答
  • 2021-02-05 17:51

    adding

    <application
    android:name="mypackagename.MyApplication"
    ... >
    

    in the manifest file, does the trick.

    0 讨论(0)
  • 2021-02-05 18:10

    @tony is right, HitBuilders.AppViewBuilder class is deprecated, but there is no need to implement onStart/Stop methods if you don't want to. As stated on GA's V4 tutorial (section 4), you can replace the AppViewBuilder class by HitBuilders.ScreenViewBuilder() and you'll get the desired result in all platforms.

    See further details on the class reference API here: https://developer.android.com/reference/com/google/android/gms/analytics/HitBuilders.ScreenViewBuilder.html

    0 讨论(0)
  • 2021-02-05 18:12

    I lost one day to this. Tried everyting, from documentation to Internet codes, nothing did the job of showing me overall screen views. Finally, after midnight today, they showed up.

    I guess, if Google real time data (sending Tracker in onCreate or similar method) is working for you, then just wait a day, that data will be processed somewhere on Google servers and be ready after some time on analytic dashboard.

    ps. don't listen to Tony, his problem is not the same as this one. But stkent has some good insights to the problem google analytics doesn't show the active user in Real time overview

    0 讨论(0)
  • 2021-02-05 18:13

    The problem according to @stkent answer is that the AppViewBuilder() is deprecated so you can fix your problem by deleteing this line of code that's what you need in your case And to help people that have same problem after following this delete this line of code

     tracker.send(new HitBuilders.AppViewBuilder().build());
    

    and add this instead

      @Override
    protected void onStart() {
        super.onStart();
        GoogleAnalytics.getInstance(this).reportActivityStart(this);
    }
    
    @Override
    protected void onStop() {
        super.onStop();
        GoogleAnalytics.getInstance(this).reportActivityStop(this);
    }
    

    in each activity you want to track

    additional info from google doc about those 2 method

    reportActivityStop
    reportActivityStart
    

    using this with auto tracking is a noop so you can disable it

    the original answer is for @skent on this post

    0 讨论(0)
提交回复
热议问题