Google Analytics - 跟踪未知
tracker = GoogleAnalyticsTracker.getInstance();
tracker.trackEvent(
"Clicks", // Category
"Button", // Action
"clicked", // Label
77);
并且
tracker.trackPageView("/HomeScreen");
tracker.dispatch();
我已经创建了一个 Google Analytics 帐户,如果转到 Analytics 设置选项卡,则在我的帐户中。我的状态为“跟踪未知”
我尝试单击编辑并单击检查状态,然后我也得到“跟踪未安装”
供参考 我的代码是:
public class GAnalytics extends Activity {
GoogleAnalyticsTracker tracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tracker = GoogleAnalyticsTracker.getInstance();
tracker.start("UA-19487404-1",20, this);
setContentView(R.layout.main);
Button createEventButton = (Button)findViewById(R.id.NewEventButton);
createEventButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.trackEvent(
"Clicks", // Category
"Button", // Action
"clicked", // Label
77); // Value
}
});
Button createPageButton = (Button)findViewById(R.id.NewPageButton);
createPageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.trackPageView("/HomeScreen");
}
});
Button quitButton = (Button)findViewById(R.id.QuitButton);
quitButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
dispatchButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.dispatch();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
super.onDestroy();
tracker.dispatch();
tracker.stop();
}
}
请指出我在哪里做错事。
I have created a testing Google Analytics sample app as directed in on Google Analytics SDK for Android documentation and I have initiated Tracking in my code using:
tracker = GoogleAnalyticsTracker.getInstance();
tracker.trackEvent(
"Clicks", // Category
"Button", // Action
"clicked", // Label
77);
And
tracker.trackPageView("/HomeScreen");
tracker.dispatch();
I have created a Google Analytics account, In my account if go to Analytics setting tab. I am getting the status as "Tracking Unknown"
I tried clicking on the edit and clicked check status, Then too I am Getting "Tracking Not Installed"
For Reference My code is:
public class GAnalytics extends Activity {
GoogleAnalyticsTracker tracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tracker = GoogleAnalyticsTracker.getInstance();
tracker.start("UA-19487404-1",20, this);
setContentView(R.layout.main);
Button createEventButton = (Button)findViewById(R.id.NewEventButton);
createEventButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.trackEvent(
"Clicks", // Category
"Button", // Action
"clicked", // Label
77); // Value
}
});
Button createPageButton = (Button)findViewById(R.id.NewPageButton);
createPageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.trackPageView("/HomeScreen");
}
});
Button quitButton = (Button)findViewById(R.id.QuitButton);
quitButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
dispatchButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tracker.dispatch();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
super.onDestroy();
tracker.dispatch();
tracker.stop();
}
}
Please point me where I am doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您在调用
.getInstance()
后是否启动了跟踪器?像这样:
您还需要调用以下命令将数据发送到Google Analytics:
Have you started the tracker after your call to
.getInstance()
?Like this:
You also need to call the following to send the data to Google Analytics:
默认情况下,分析数据晚一天,您是否修改报告日期以显示当天?如果是这样,请记住,延迟 30 分钟并不罕见。
By default, analytics data is one day behind, are you modifying the reporting dates to show the current day? If so, bear in mind that a 30 minute delay is not at all unusual.
参考下面的代码
Refer below code