什么可能导致分析命中不会被发送到服务器?这是我的日志
12-16 17:19:41.921 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: connecting to Analytics service
12-16 17:19:41.951 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: connect: bindService returned true for Intent { act=com.google.android.gms.analytics.service.START cmp=com.google.android.gms/.analytics.service.AnalyticsService (has extras) }
12-16 17:19:42.021 15731-15758/com.zapk.lsmods I/GAV4﹕ Thread[GAThread,5,main]: No campaign data found.
12-16 17:19:42.021 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: Initialized GA Thread
12-16 17:19:42.021 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: Loaded clientId
12-16 17:19:42.031 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: putHit called
12-16 17:19:42.061 15731-15731/com.zapk.lsmods V/GAV4﹕ Thread[main,5,main]: service connected, binder: android.os.BinderProxy@41546a38
12-16 17:19:42.061 15731-15731/com.zapk.lsmods V/GAV4﹕ Thread[main,5,main]: bound to service
12-16 17:19:42.061 15731-15731/com.zapk.lsmods V/GAV4﹕ Thread[main,5,main]: Connected to service
12-16 17:19:42.141 15731-15758/com.zapk.lsmods V/GAV4﹕ Thread[GAThread,5,main]: Sending hit to service PATH: https: PARAMS: v=1, ul=en-gb, t=screenview, ht=1418743176826, sr=540x960, a=2025550344, an=Farming simulator 15 mods, tid=UA-57677772-1, aid=com.zapk.lsmods, cid=c892183c-7dbc-4170-b0c7-5f73fc0a820c, av=1.0, _u=.22nK-AL, cd=MainActivity,
这是我的AppController的代码 //应更改以下行以包含正确的属性ID。
private static final String PROPERTY_ID = "UA-XXXX-1";
public static int GENERAL_TRACKER = 0;
public enum TrackerName {
APP_TRACKER, // Tracker used only in this app.
GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a company.
}
public HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
public AppController() {
super();
}
private void initGoogleAnalytics() {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
analytics.setDryRun(false);
analytics.setLocalDispatchPeriod(1);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
analytics.enableAutoActivityReports(this);
}
@Override
public void onCreate() {
super.onCreate();
initGoogleAnalytics();
}
public synchronized Tracker getTracker(TrackerName trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID): (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker): analytics.newTracker(R.xml.ecommerce_tracker);
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
然后我将这样的分析称为:
Tracker track = ((AppController)this.getApplication()).getTracker(AppController.TrackerName.APP_TRACKER);
track.setScreenName("MainActivity");
track.send(new HitBuilders.ScreenViewBuilder().build());
这是我的app_tracker xml文件的代码:
<string name="ga_trackingId">UA-XXXXX-1</string>
<bool name="ga_autoActivityTracking">true</bool>
<bool name="ga_reportUncaughtExceptions">true</bool>
<string name="ga_appName">Serivce</string>
<string name="ga_appVersion">1.1.3</string>
<bool name="ga_debug">true</bool>
<item name="ga_dispatchPeriod" format="integer" type="integer">120</item>
<string name="ga_sampleFrequency">90</string>
<bool name="ga_dryRun">false</bool>
<!-- Percentage of events to include in reports -->
<string name="ga_sampleFrequency">100.0</string>
<!-- How long a session exists before giving up -->
<integer name="ga_sessionTimeout">2000</integer>
<screenName name="com.zapk.lsmods.MainActivity">
MainActivity
</screenName>
<screenName name="com.zapk.lsmods.MainFragment">
AnalyticsSampleApp MainFragment
</screenName>
我马上发送了一次我的点击,但我仍然无法在我的分析仪表板中看到任何信息。