feature: add keycard metric events (#21794)

This change adds some metrics events for tracking when keycard users have reached an unavailable feature, when keycard users have successfully logged in, and when keycard users have succeeded or failed to migrate to keycard.
This commit is contained in:
Sean Hagstrom 2024-12-12 09:21:09 -08:00 committed by GitHub
parent 676998b83b
commit 55ee800e18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 50 additions and 18 deletions

View File

@ -53,7 +53,13 @@
(conj (navigation-event (name view-id))) (conj (navigation-event (name view-id)))
(= :screen/onboarding.syncing-results view-id) (= :screen/onboarding.syncing-results view-id)
(conj (key-value-event "onboarding-completed"))))) (conj (key-value-event "onboarding-completed"))
(= :screen/keycard.migrate.success view-id)
(conj (key-value-event "keycard-migration-succeeded"))
(= :screen/keycard.migrate.fail view-id)
(conj (key-value-event "keycard-migration-failed")))))
(defn navigated-to-collectibles-tab-event (defn navigated-to-collectibles-tab-event
[location] [location]

View File

@ -30,7 +30,8 @@
{:keys [color name images]} (rf/sub [:communities/community id]) {:keys [color name images]} (rf/sub [:communities/community id])
keycard? (rf/sub [:keycard/keycard-profile?]) keycard? (rf/sub [:keycard/keycard-profile?])
keycard-feature-unavailable (rn/use-callback keycard-feature-unavailable (rn/use-callback
#(rf/dispatch [:keycard/feature-unavailable-show]))] #(rf/dispatch [:keycard/feature-unavailable-show
{:feature-name :community.request-to-join}]))]
[rn/safe-area-view {:flex 1} [rn/safe-area-view {:flex 1}
[gesture/scroll-view {:style style/container} [gesture/scroll-view {:style style/container}
[rn/view style/page-container [rn/view style/page-container

View File

@ -147,7 +147,8 @@
[:show-bottom-sheet {:content token-gated-communities-info}]) [:show-bottom-sheet {:content token-gated-communities-info}])
keycard? (rf/sub [:keycard/keycard-profile?]) keycard? (rf/sub [:keycard/keycard-profile?])
keycard-feature-unavailable (rn/use-callback keycard-feature-unavailable (rn/use-callback
#(rf/dispatch [:keycard/feature-unavailable-show]))] #(rf/dispatch [:keycard/feature-unavailable-show
{:feature-name :community.request-to-join}]))]
(cond (cond
networks-not-supported? networks-not-supported?

View File

@ -1,12 +1,27 @@
(ns status-im.contexts.keycard.feature-unavailable.events (ns status-im.contexts.keycard.feature-unavailable.events
(:require (:require
[status-im.constants :as constants]
[status-im.contexts.keycard.feature-unavailable.view :as feature-unavailable] [status-im.contexts.keycard.feature-unavailable.view :as feature-unavailable]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(rf/reg-event-fx
:keycard/feature-unavailable-upvote
(fn [_ [{:keys [feature-name]}]]
{:fx [[:dispatch [:open-url constants/mobile-upvote-link]]
[:dispatch
[:centralized-metrics/track
:metric/feature-unavailable-upvote
{:feature-name feature-name}]]]}))
(rf/reg-event-fx (rf/reg-event-fx
:keycard/feature-unavailable-show :keycard/feature-unavailable-show
(fn [_ [options]] (fn [_ [{:keys [feature-name theme] :as options}]]
{:fx [[:dispatch {:fx [[:dispatch
[:show-bottom-sheet [:show-bottom-sheet
{:theme (:theme options) {:theme theme
:content feature-unavailable/view}]]]})) :content (fn []
(feature-unavailable/view options))}]]
[:dispatch
[:centralized-metrics/track
:metric/feature-unavailable
{:feature-name feature-name}]]]}))

View File

@ -1,16 +1,15 @@
(ns status-im.contexts.keycard.feature-unavailable.view (ns status-im.contexts.keycard.feature-unavailable.view
(:require (:require
[quo.core :as quo] [quo.core :as quo]
[status-im.constants :as constants]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn on-upvote (defn on-upvote
[] [feature-name]
(rf/dispatch [:open-url constants/mobile-upvote-link])) (rf/dispatch [:keycard/feature-unavailable-upvote {:feature-name feature-name}]))
(defn view (defn view
[] [{:keys [feature-name]}]
[:<> [:<>
[quo/drawer-top [quo/drawer-top
{:title (i18n/label :t/feature-unavailable) {:title (i18n/label :t/feature-unavailable)
@ -24,5 +23,5 @@
[quo/text [quo/text
{:style {:text-decoration-line :underline} {:style {:text-decoration-line :underline}
:size :paragraph-2 :size :paragraph-2
:on-press on-upvote} :on-press #(on-upvote feature-name)}
(i18n/label :t/upvote-it)]]]]) (i18n/label :t/upvote-it)]]]])

View File

@ -47,7 +47,8 @@
settings settings
{:log-level log-level})) {:log-level log-level}))
(assoc-in [:activity-center :loading?] true) (assoc-in [:activity-center :loading?] true)
(dissoc :centralized-metrics/onboarding-enabled?))] (dissoc :centralized-metrics/onboarding-enabled?))
keycard? (get-in new-db [:profile/profile :keycard-pairing])]
{:db (cond-> new-db {:db (cond-> new-db
pairing-completed? (dissoc :syncing)) pairing-completed? (dissoc :syncing))
:fx (into [[:json-rpc/call :fx (into [[:json-rpc/call
@ -75,8 +76,10 @@
[:effects.chat/open-last-chat (:key-uid profile-overview)]) [:effects.chat/open-last-chat (:key-uid profile-overview)])
(when (:centralized-metrics/onboarding-enabled? db) (when (:centralized-metrics/onboarding-enabled? db)
[:dispatch [:profile.settings/toggle-telemetry true]])] [:dispatch [:profile.settings/toggle-telemetry true]])
(when keycard?
[:dispatch [:centralized-metrics/track :metric/keycard-login]])]
(cond (cond
pairing-completed? pairing-completed?
[[:dispatch [:update-theme-and-init-root :screen/onboarding.syncing-results]]] [[:dispatch [:update-theme-and-init-root :screen/onboarding.syncing-results]]]

View File

@ -10,7 +10,9 @@
[button-label theme keycard-profile?] [button-label theme keycard-profile?]
(fn [] (fn []
(if keycard-profile? (if keycard-profile?
(rf/dispatch [:keycard/feature-unavailable-show {:theme :dark}]) (rf/dispatch [:keycard/feature-unavailable-show
{:theme :dark
:feature-name :settings.enable-biometrics}])
(rf/dispatch (rf/dispatch
[:standard-auth/authorize-with-password [:standard-auth/authorize-with-password
{:blur? true {:blur? true

View File

@ -41,8 +41,10 @@
other-devices) other-devices)
keycard? (rf/sub [:keycard/keycard-profile?]) keycard? (rf/sub [:keycard/keycard-profile?])
keycard-feature-unavailable (rn/use-callback keycard-feature-unavailable (rn/use-callback
#(rf/dispatch [:keycard/feature-unavailable-show #(rf/dispatch
{:theme :dark}]))] [:keycard/feature-unavailable-show
{:theme :dark
:feature-name :settings.setup-syncing}]))]
[quo/overlay {:type :shell :top-inset? true} [quo/overlay {:type :shell :top-inset? true}
[quo/page-nav [quo/page-nav
{:type :no-title {:type :no-title

View File

@ -48,7 +48,8 @@
{:icon-name :i/dapps {:icon-name :i/dapps
:on-press #(rf/dispatch :on-press #(rf/dispatch
(if keycard? (if keycard?
[:keycard/feature-unavailable-show] [:keycard/feature-unavailable-show
{:feature-name :wallet.show-connected-dapps}]
[:navigate-to :screen/wallet.connected-dapps]))}) [:navigate-to :screen/wallet.connected-dapps]))})
(when-not sending-collectible? (when-not sending-collectible?
{:content-type :account-switcher {:content-type :account-switcher

View File

@ -36,7 +36,9 @@
(cond (cond
keycard? keycard?
{:fx [[:dispatch [:keycard/feature-unavailable-show]]]} {:fx [[:dispatch
[:keycard/feature-unavailable-show
{:feature-name :wallet.scan-dapp-connection}]]]}
(or (not valid-wc-uri?) (or (not valid-wc-uri?)
(not version-supported?) (not version-supported?)