JAL-4001 Working Plausible analytics
[jalview.git] / src / jalview / bin / Cache.java
index 4e73b82..fbd70dd 100755 (executable)
@@ -53,7 +53,7 @@ import java.util.TreeSet;
 import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
-import jalview.analytics.GoogleAnalytics4;
+import jalview.analytics.Plausible;
 import jalview.datamodel.PDBEntry;
 import jalview.gui.Preferences;
 import jalview.gui.UserDefinedColours;
@@ -964,7 +964,7 @@ public class Cache
 
   public static void initGoogleTracker(boolean headless)
   {
-    GoogleAnalytics4.setEnabled(true);
+    Plausible.setEnabled(true);
 
     String appName = ChannelProperties.getProperty("app_name") + " Desktop";
     String version = Cache.getProperty("VERSION") + "_"
@@ -991,31 +991,14 @@ public class Cache
     /*
     }
     */
-    GoogleAnalytics4 ga4 = GoogleAnalytics4.getInstance();
-
-    // This will add a page_view similar to the old UA analytics.
-    // We probably want to get rid of this once the application_launch event
-    // is being processed properly.
-    String[] params;
-    if (headless)
-    {
-      params = new String[] { "page_location",
-          GoogleAnalytics4.APPLICATION_BASE_URL + path, "page_title",
-          APPLICATION_STARTED, "headless", "true" };
-    }
-    else
-    {
-      params = new String[] { "page_location", path, "page_title",
-          APPLICATION_STARTED };
-    }
-    ga4.sendAnalytics("page_view", params);
+    Plausible plausible = Plausible.getInstance();
 
     // This will send a new "application_launch" event with parameters
     // including the old-style "path", the channel name and version
-    ga4.sendAnalytics("application_launch", true, params);
+    plausible.sendEvent("application_launch", path, true);
   }
 
-  private static final String APPLICATION_STARTED = "Application Started.";
+  private static final String APPLICATION_STARTED = "Application Started";
 
   /**
    * get the user's default colour if available