Question

I'm trying to figure out how to track page views in real time without using the EasyTracker singleton.

I have the following code:

/**
 * This how I create the tracker instance...
 */
private void createTracker() {
    if (tracker != null)
        return;

    tracker = googleAnalytics.getTracker(googleAnalyticsSiteId);
    tracker.setAnonymizeIp(trackingLevel.isAnonymous());
    tracker.setAppInstallerId(configuration.getInstallationUUID());
    tracker.setSampleRate(dispatchIntervalInSeconds);
    trackUpgradedApp();
}

... 
void someOtherMethod(Activity activity){
    tracker.sendView((String) activity.getTitle());
// EasyTracker.getInstance().activityStart(cyborgScreen.getActivity());
}

While I uncomment the EasyTracker line, I can track the pages visited in realtime, but only after adding the analytics.xml to the project (obviously).

Once commenting the line, I do not receive the realtime information... If following the code here, it should have done the trick.

Am I missing the obvious, or there is a bug?

Thanks, Adam.

Was it helpful?

Solution

Well, after tones of playing around deleting, coping, changing things, I've found that this:

GAServiceManager.getInstance().setDispatchPeriod(dispatchIntervalInSeconds);

was missing, and that is why I could not see the realtime screen event without using the EasyTracker!

Hope this helps someone...

OTHER TIPS

The answer is you call:

tracker.sendView((String) activity.getTitle());

but it can take time until you see it!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top