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.

有帮助吗?

解决方案

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...

其他提示

The answer is you call:

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

but it can take time until you see it!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top