From 4e0ff484d221b0da63bbcfb2b81e9fd00c114f52 Mon Sep 17 00:00:00 2001 From: Kyle Doherty <kdoh@users.noreply.github.com> Date: Wed, 13 Jul 2016 13:01:51 -0700 Subject: [PATCH] track auth events (#2941) --- frontend/src/metabase/auth/auth.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/metabase/auth/auth.js b/frontend/src/metabase/auth/auth.js index 40f3bc15c1e..3af4c586eda 100644 --- a/frontend/src/metabase/auth/auth.js +++ b/frontend/src/metabase/auth/auth.js @@ -3,6 +3,7 @@ import { handleActions, combineReducers, AngularResourceProxy, createThunkAction import MetabaseCookies from "metabase/lib/cookies"; import MetabaseUtils from "metabase/lib/utils"; +import MetabaseAnalytics from "metabase/lib/analytics"; import { clearGoogleAuthCredentials } from "metabase/lib/auth"; @@ -25,6 +26,7 @@ export const login = createThunkAction("AUTH_LOGIN", function(credentials, onCha // since we succeeded, lets set the session cookie MetabaseCookies.setSessionCookie(newSession.id); + MetabaseAnalytics.trackEvent('Auth', 'Login'); // TODO: redirect after login (carry user to intended destination) // this is ridiculously stupid. we have to wait (300ms) for the cookie to actually be set in the browser :( setTimeout(() => onChangeLocation("/"), 300); @@ -47,6 +49,8 @@ export const loginGoogle = createThunkAction("AUTH_LOGIN_GOOGLE", function(googl // since we succeeded, lets set the session cookie MetabaseCookies.setSessionCookie(newSession.id); + MetabaseAnalytics.trackEvent('Auth', 'Google Auth Login'); + // TODO: redirect after login (carry user to intended destination) // this is ridiculously stupid. we have to wait (300ms) for the cookie to actually be set in the browser :( setTimeout(() => onChangeLocation("/"), 300); @@ -73,6 +77,7 @@ export const logout = createThunkAction("AUTH_LOGOUT", function(onChangeLocation // actively delete the session SessionApi.delete({'session_id': sessionId}); } + MetabaseAnalytics.trackEvent('Auth', 'Logout'); setTimeout(() => onChangeLocation("/auth/login"), 300); }; @@ -97,6 +102,8 @@ export const passwordReset = createThunkAction("AUTH_PASSWORD_RESET", function(t MetabaseCookies.setSessionCookie(result.session_id); } + MetabaseAnalytics.trackEvent('Auth', 'Password Reset'); + return { success: true, error: null -- GitLab