我正在检查一个示例谷歌分析Android应用程序,但我的谷歌分析帐户中没有显示数据。这是我的代码:
public class ClickTrackerActivity extends Activity {
GoogleAnalyticsTracker tracker;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Start your statistics tracking
tracker = GoogleAnalyticsTracker.getInstance();
tracker.startNewSession("UA-39298495-1", 30, this);
setContentView(R.layout.main);
tracker.trackPageView("/ClickTracker-Main-Screen");
}
@Override
protected void onDestroy() {
super.onDestroy();
tracker.stopSession();
}
public void onClickHighButton(View v) {
// High button clicked.
Toast.makeText(ClickTrackerActivity.this, "Chose the High Road", Toast.LENGTH_SHORT).show();
tracker.trackEvent("Clicks", "Button", "High Road", 0);
tracker.dispatch();
}
public void onClickLowButton(View v) {
// Low button clicked.
Toast.makeText(ClickTrackerActivity.this, "Chose the Low Road", Toast.LENGTH_SHORT).show();
tracker.trackEvent("Clicks", "Button", "Low Road", 0);
}
}
这可能是什么原因?是否需要一些时间来显示数据?