diff --git a/src/auth.js b/src/auth.js index b39e023..f9bb084 100644 --- a/src/auth.js +++ b/src/auth.js @@ -1,3 +1,5 @@ +/* global trackEvent */ + window.logout = function logout() { firebase.auth().signOut(); }; @@ -17,7 +19,9 @@ function login(providerName) { return firebase .auth() .signInWithPopup(provider) - .then(function() {}) + .then(function() { + trackEvent('fn', 'loggedIn', providerName); + }) .catch(function(error) { alert( 'You have already signed up with the same email using different social login' diff --git a/src/index.html b/src/index.html index 650c049..c0af87d 100644 --- a/src/index.html +++ b/src/index.html @@ -88,10 +88,10 @@ Open - + Login/Signup - + diff --git a/src/script.js b/src/script.js index 71f1575..d6b37d5 100644 --- a/src/script.js +++ b/src/script.js @@ -2032,6 +2032,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName scope.login = e => { const provider = e.target.dataset.authProvider; + trackEvent('ui', 'loginProviderClick', provider); window.login(provider); if (e) { e.preventDefault(); @@ -2045,6 +2046,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName ); if (!shouldDiscard) { return; } } + trackEvent('fn', 'loggedOut'); window.logout(); }