From 5c1f36384d13f652324bc2ea085c8162596f6d9e Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 7 Jun 2023 15:37:22 +0100 Subject: [PATCH] JAL-4001 Added more params for application_launch --- src/jalview/analytics/GoogleAnalytics4.java | 38 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/jalview/analytics/GoogleAnalytics4.java b/src/jalview/analytics/GoogleAnalytics4.java index 16f7654..5ae9c12 100644 --- a/src/jalview/analytics/GoogleAnalytics4.java +++ b/src/jalview/analytics/GoogleAnalytics4.java @@ -49,15 +49,36 @@ public class GoogleAnalytics4 private static GoogleAnalytics4 instance = null; - private static final String appName; - - private static final String version; + private static final Map defaultParams; static { - appName = ChannelProperties.getProperty("app_name") + " Desktop"; - version = Cache.getProperty("VERSION") + "_" - + Cache.getDefault("BUILD_DATE", "unknown"); + defaultParams = new HashMap<>(); + defaultParams.put("app_name", + ChannelProperties.getProperty("app_name") + " Desktop"); + defaultParams.put("version", Cache.getProperty("VERSION")); + defaultParams.put("build_date", + Cache.getDefault("BUILD_DATE", "unknown")); + defaultParams.put("java_version", System.getProperty("java.version")); + String val = System.getProperty("sys.install4jVersion"); + if (val != null) + { + defaultParams.put("install4j_version", val); + } + val = System.getProperty("installer_template_version"); + if (val != null) + { + defaultParams.put("install4j_template_version", val); + } + val = System.getProperty("launcher_version"); + if (val != null) + { + defaultParams.put("launcher_version", val); + } + defaultParams.put("java_arch", + System.getProperty("os.arch") + " " + + System.getProperty("os.name") + " " + + System.getProperty("os.version")); } private GoogleAnalytics4() @@ -83,10 +104,9 @@ public class GoogleAnalytics4 Map params = new HashMap<>(); // add these to all events from this application instance - params.put("app_name", appName); - params.put("version", version); + params.putAll(defaultParams); - // can be overwritten by passed in params + // add (and overwrite with) the passed in params if (paramsStrings != null && paramsStrings.length > 0) { if (paramsStrings.length % 2 != 0) -- 1.7.10.2