From bb1c12b0501f5426aedeffe6233a7e88a8cd13c5 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 12 Mar 2020 12:36:45 -0400 Subject: [PATCH] pass trending_algorithm to ga --- ui/analytics.js | 3 +++ ui/redux/actions/app.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/analytics.js b/ui/analytics.js index a0a333d48..17bb68265 100644 --- a/ui/analytics.js +++ b/ui/analytics.js @@ -202,6 +202,9 @@ const analytics: Analytics = { openUrlEvent: (url: string) => { sendGaEvent('Engagement', 'Open-Url', url); }, + trendingAlgorithmEvent: (trendingAlgorithm: string) => { + sendGaEvent('Engagement', 'Trending-Algorithm', trendingAlgorithm); + }, startupEvent: () => { sendGaEvent('Startup', 'Startup'); }, diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index b7ec14f5d..f65345bb2 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -329,7 +329,19 @@ export function doDaemonReady() { // TODO: call doFetchDaemonSettings, then get usage data, and call doAuthenticate once they are loaded into the store const shareUsageData = window.localStorage.getItem(SHARE_INTERNAL) === 'true' || IS_WEB; - dispatch(doAuthenticate(appVersion, undefined, undefined, shareUsageData)); + dispatch( + doAuthenticate(appVersion, undefined, undefined, shareUsageData, status => { + const trendingAlgorithm = + status && + status.wallet && + status.wallet.connected_features && + status.wallet.connected_features.trending_algorithm; + + if (trendingAlgorithm) { + analytics.trendingAlgorithmEvent(trendingAlgorithm); + } + }) + ); dispatch({ type: ACTIONS.DAEMON_READY }); // @if TARGET='app'