Explorar el Código

fix: add mobile app_type instrument

Tienson Qin hace 4 años
padre
commit
e1a0613438
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. 9 1
      src/main/frontend/modules/instrumentation/posthog.cljs

+ 9 - 1
src/main/frontend/modules/instrumentation/posthog.cljs

@@ -1,6 +1,7 @@
 (ns frontend.modules.instrumentation.posthog
   (:require [frontend.config :as cfg]
             [frontend.util :as util]
+            [frontend.mobile.util :as mobile]
             [frontend.version :refer [version]]
             ["posthog-js" :as posthog]
             [cljs-bean.core :as bean]))
@@ -11,7 +12,14 @@
 (defn register []
   (posthog/register
    (clj->js
-    {:app_type (if (util/electron?) "electron" "web")
+    {:app_type (let [platform (mobile/platform)]
+                 (cond
+                   platform
+                   platform
+                   (util/electron?)
+                   "electron"
+                   :else
+                   "web"))
      :app_env (if cfg/dev? "development" "production")
      :app_ver version
      :schema_ver 0