mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-18 12:31:12 +02:00
add events
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
/* global trackEvent */
|
||||||
|
|
||||||
window.logout = function logout() {
|
window.logout = function logout() {
|
||||||
firebase.auth().signOut();
|
firebase.auth().signOut();
|
||||||
};
|
};
|
||||||
@@ -17,7 +19,9 @@ function login(providerName) {
|
|||||||
return firebase
|
return firebase
|
||||||
.auth()
|
.auth()
|
||||||
.signInWithPopup(provider)
|
.signInWithPopup(provider)
|
||||||
.then(function() {})
|
.then(function() {
|
||||||
|
trackEvent('fn', 'loggedIn', providerName);
|
||||||
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
alert(
|
alert(
|
||||||
'You have already signed up with the same email using different social login'
|
'You have already signed up with the same email using different social login'
|
||||||
|
@@ -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" />
|
<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
|
</svg>Open
|
||||||
</a>
|
</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
|
Login/Signup
|
||||||
</a>
|
</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"/>
|
<img id="headerAvatarImg" width="20" src="" class="main-header__avatar-img"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -2032,6 +2032,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName
|
|||||||
|
|
||||||
scope.login = e => {
|
scope.login = e => {
|
||||||
const provider = e.target.dataset.authProvider;
|
const provider = e.target.dataset.authProvider;
|
||||||
|
trackEvent('ui', 'loginProviderClick', provider);
|
||||||
window.login(provider);
|
window.login(provider);
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -2045,6 +2046,7 @@ loginModal, profileModal, profileAvatarImg, profileUserName
|
|||||||
);
|
);
|
||||||
if (!shouldDiscard) { return; }
|
if (!shouldDiscard) { return; }
|
||||||
}
|
}
|
||||||
|
trackEvent('fn', 'loggedOut');
|
||||||
window.logout();
|
window.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user