Skip to content
Snippets Groups Projects
Commit 4e0ff484 authored by Kyle Doherty's avatar Kyle Doherty Committed by GitHub
Browse files

track auth events (#2941)

parent 6b646f79
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment