为 Google Analytics(分析)启动多个会话
我尝试为 Google Analytics 启动两个会话,但仅针对 trackerB 进行跟踪。有没有办法跟踪两个不同配置文件的数据?
public GoogleAnalyticsTracker trackerA;
public GoogleAnalyticsTracker trackerB;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getApplication();
trackerA = GoogleAnalyticsTracker.getInstance();
trackerB = GoogleAnalyticsTracker.getInstance();
trackerA.startNewSession("UA-XXXXXX-Y", mContext);
trackerB.startNewSession("UA-XXXXXX-YY", mContext);
....
}
I tried to start two sessions for google analytics, however it is only tracked for trackerB. Is there any way to track data for two different profiles?
public GoogleAnalyticsTracker trackerA;
public GoogleAnalyticsTracker trackerB;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getApplication();
trackerA = GoogleAnalyticsTracker.getInstance();
trackerB = GoogleAnalyticsTracker.getInstance();
trackerA.startNewSession("UA-XXXXXX-Y", mContext);
trackerB.startNewSession("UA-XXXXXX-YY", mContext);
....
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所说的跟踪器是管理全局状态的单例。您可以通过
以下方式获取实际的跟踪器:请参阅:https://developers.google.com/analytics/devguides/collection/android/v2/advanced#managing-trackers
What you are calling tracker is a singleton that manages the global state.you can get the actual tracker by:
refer to this: https://developers.google.com/analytics/devguides/collection/android/v2/advanced#managing-trackers