谷歌分析不显示当前用户

时间:2017-08-04 11:16:58

标签: android google-analytics-api

我正在为Android中的应用跟踪实施Google分析。我遵循该文档中提到的Google文档,但它不会在分析仪表板中显示任何活动用户。 我的代码在Application Class

private static GoogleAnalytics sAnalytics;
private static Tracker sTracker;

sAnalytics = GoogleAnalytics.getInstance(this);


synchronized public Tracker getDefaultTracker() {
    // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
    if (sTracker == null) {
        sTracker = sAnalytics.newTracker(R.xml.global_tracker);
    }

    return sTracker;
}

活动

  Tracker mTracker;
  MyAppplication application = (MyAppplication) getApplication();
    mTracker = application.getDefaultTracker();


    mTracker.setScreenName("User Profile");
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());

在清单文件中

 <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
        android:enabled="true">
        <intent-filter>
            <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
        </intent-filter>
    </receiver>
    <service android:name="com.google.android.gms.analytics.AnalyticsService"
        android:enabled="true"
        android:exported="false"/>

    <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>
    <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />

in global_tracker

 <string name="ga_trackingId" translatable="false">UA-10*******-1</string>

使用此Gradel依赖

compile 'com.google.android.gms:play-services-analytics:10.2.4'

1 个答案:

答案 0 :(得分:1)

google anyltic仅适用于旧用户。对于新用户,您必须添加firbase。