1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-26 00:11:13 +02:00

add events

This commit is contained in:
Kushagra Gour
2018-01-19 11:42:53 +05:30
parent 8acf653a5c
commit ca69ae77d2
3 changed files with 9 additions and 3 deletions

View File

@@ -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'

View File

@@ -88,10 +88,10 @@
<path d="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z" />
</svg>Open
</a>
<a class="show-when-app hide-on-login flex flex-v-center hint--rounded hint--bottom-left" aria-label="Login/Signup" d-open-modal="loginModal">
<a d-open-modal="loginModal" data-event-category="ui" data-event-action="loginButtonClick" class="show-when-app hide-on-login flex flex-v-center hint--rounded hint--bottom-left" aria-label="Login/Signup">
Login/Signup
</a>
<a d-open-modal="profileModal" aria-label="See profile or Logout" class="hide-on-logout">
<a d-open-modal="profileModal" data-event-category="ui" data-event-action="headerAvatarClick" aria-label="See profile or Logout" class="hide-on-logout hint--rounded hint--bottom-left">
<img id="headerAvatarImg" width="20" src="" class="main-header__avatar-img"/>
</a>
</div>

View File

@@ -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();
}