What's the difference between EasyTracker and the regular Tracker?

こ雲淡風輕ζ 提交于 2019-12-10 12:43:29

问题


The Google documentation for Google Analytics version 3 is very confusing regarding the differences between EasyTracker and the regular Tracker class, and I'm really not sure which one I should be using. On this page, they talk about setting up the EasyTracker, using the analytics.xml file to set up your ID, but then on the next page they talk about setting up a regular tracker and passing it your ID:

// Initialize a tracker using a Google Analytics property ID.
GoogleAnalytics.getInstance(this).getTracker("UA-XXXX-Y")

What are the differences between these two trackers? Does one have more features than the other? I gather that the EasyTracker is simpler to set up if you just want Activity tracking, but if I want to use all of the features available to me in Google Analytics, can I still do all that with the EasyTracker, or do I need to switch to the regular Tracker?


回答1:


I ended up going straight to the Google Analytics Developer Forum to get the answer:

EasyTracker is a subclass of Tracker that may be conveniently initialized via xml resource values, rather than programmatically.

EasyTracker also provides automatic session management, by keeping track of whether your app is in the foreground or background via the EasyTracker.getInstance(context).activityStart() and activityStop() methods.

If you just use Tracker, you need to programmatically initialize it with all of your desired config options, and you don't get the automatic session management that takes into consideration when your app is in the foreground or background -- instead, the lengths of your sessions will be determined solely by the Session Timeout Period you've configured in the GA interface for your property.

Subsequent discussion there didn't seem to turn up any situation where you wouldn't want to use an EasyTracker if you're just starting out.

Another important note - there are full fledged javadocs for the code that are only available as part of the code package, and not available anywhere on their public website.



来源:https://stackoverflow.com/questions/19961520/whats-the-difference-between-easytracker-and-the-regular-tracker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!