I want to use google analytics within a fragment for tracking screen views. I don't understand where we should allocate a Tracker instance. The doc on manual screen tracking leaves us with this example:
/**
* Within an Activity or Fragment
*/
@Override
public void onStart() {
super.onStart();
... // Your other onStart() code.
myTracker.sendView("Home Screen"); // Where myTracker is an instance of Tracker.
}
https://developers.google.com/analytics/devguides/collection/android/v2/screens
Where is "myTracker" defined? What is its lifecycle? I'm looking for a skeleton Fragment that shows the lifecycle of the "myTracker" variable.
Thanks