* better simulate website behaviour

This commit is contained in:
Reinhard Pointner 2011-10-14 10:24:53 +00:00
parent 7ee4b06c7c
commit 55db3e62bc
1 changed files with 12 additions and 1 deletions

View File

@ -26,9 +26,12 @@ public class Analytics {
private static final String TIMESTAMP_LAST = "timestampLast"; private static final String TIMESTAMP_LAST = "timestampLast";
private static final String VISITS = "visits"; private static final String VISITS = "visits";
private static final String host = "filebot.sourceforge.net";
private static final VisitorData visitorData = restoreVisitorData(); private static final VisitorData visitorData = restoreVisitorData();
private static final JGoogleAnalyticsTracker tracker = new JGoogleAnalyticsTracker(getConfig(getApplicationProperty("analytics.WebPropertyID"), visitorData), V_4_7_2); private static final JGoogleAnalyticsTracker tracker = new JGoogleAnalyticsTracker(getConfig(getApplicationProperty("analytics.WebPropertyID"), visitorData), V_4_7_2);
private static String currentView = null;
public static void trackView(Class<?> view, String title) { public static void trackView(Class<?> view, String title) {
trackView(view.getName().replace('.', '/'), title); trackView(view.getName().replace('.', '/'), title);
@ -39,7 +42,15 @@ public class Analytics {
if (!tracker.isEnabled()) if (!tracker.isEnabled())
return; return;
tracker.trackPageViewFromSearch(view, title, "filebot.sourceforge.net", getJavaVersionIdentifier(), getDeploymentMethod()); if (currentView == null) {
// track application startup
tracker.trackPageViewFromSearch(view, title, host, getJavaVersionIdentifier(), getDeploymentMethod());
} else {
// track view change
tracker.trackPageView(view, title, host);
}
currentView = view;
} }